From 6afe633de88a600897c5f4e454fec6614eb466ae Mon Sep 17 00:00:00 2001 From: 170210 <85928898+170210@users.noreply.github.com> Date: Thu, 18 Apr 2024 16:33:20 +0900 Subject: [PATCH 1/7] 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 --- CHANGELOG.md | 1 + docs/core/proto-docs.md | 311 ++++++++ go.sum | 2 - proto/lbm/fswap/v1/event.proto | 18 + proto/lbm/fswap/v1/fswap.proto | 14 + proto/lbm/fswap/v1/genesis.proto | 14 + proto/lbm/fswap/v1/params.proto | 13 + proto/lbm/fswap/v1/query.proto | 29 + proto/lbm/fswap/v1/tx.proto | 29 + x/ERRORS.md | 10 + x/fswap/client/cli/query.go | 79 ++ x/fswap/client/cli/tx.go | 95 +++ x/fswap/genesis.go | 24 + x/fswap/genesis_test.go | 1 + x/fswap/handler.go | 26 + x/fswap/keeper/grpc_query.go | 19 + x/fswap/keeper/grpc_query_params_test.go | 1 + x/fswap/keeper/keeper.go | 39 + x/fswap/keeper/msg_server.go | 29 + x/fswap/keeper/msg_server_test.go | 1 + x/fswap/keeper/params.go | 16 + x/fswap/keeper/params_test.go | 1 + x/fswap/keeper/query_params_test.go | 1 + x/fswap/module.go | 168 +++++ x/fswap/module_simulation.go | 1 + x/fswap/simulation/simap.go | 15 + x/fswap/types/codec.go | 23 + x/fswap/types/errors.go | 12 + x/fswap/types/event.pb.go | 433 +++++++++++ x/fswap/types/expected_keepers.go | 18 + x/fswap/types/fswap.pb.go | 378 ++++++++++ x/fswap/types/genesis.go | 24 + x/fswap/types/genesis.pb.go | 376 ++++++++++ x/fswap/types/genesis_test.go | 41 + x/fswap/types/keys.go | 22 + x/fswap/types/msgs.go | 70 ++ x/fswap/types/params.go | 26 + x/fswap/types/params.pb.go | 319 ++++++++ x/fswap/types/query.pb.go | 868 +++++++++++++++++++++ x/fswap/types/query.pb.gw.go | 210 ++++++ x/fswap/types/tx.pb.go | 913 +++++++++++++++++++++++ x/fswap/types/types.go | 1 + 42 files changed, 4689 insertions(+), 2 deletions(-) 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/params.proto create mode 100644 proto/lbm/fswap/v1/query.proto create mode 100644 proto/lbm/fswap/v1/tx.proto create mode 100644 x/fswap/client/cli/query.go create mode 100644 x/fswap/client/cli/tx.go create mode 100644 x/fswap/genesis.go create mode 100644 x/fswap/genesis_test.go create mode 100644 x/fswap/handler.go create mode 100644 x/fswap/keeper/grpc_query.go create mode 100644 x/fswap/keeper/grpc_query_params_test.go create mode 100644 x/fswap/keeper/keeper.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/params.go create mode 100644 x/fswap/keeper/params_test.go create mode 100644 x/fswap/keeper/query_params_test.go create mode 100644 x/fswap/module.go create mode 100644 x/fswap/module_simulation.go create mode 100644 x/fswap/simulation/simap.go create mode 100644 x/fswap/types/codec.go create mode 100644 x/fswap/types/errors.go create mode 100644 x/fswap/types/event.pb.go create mode 100644 x/fswap/types/expected_keepers.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/params.go create mode 100644 x/fswap/types/params.pb.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 create mode 100644 x/fswap/types/types.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 4479669cfc..a88a6c5ca3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,6 +40,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Features * (consensus) [\#1178](https://github.com/Finschia/finschia-sdk/pull/1178) change the consensus from Ostracon to Tendermint v0.34.24 +* (x/fswap) [\#1336](https://github.com/Finschia/finschia-sdk/pull/1336) Initialize fswap module ### Improvements * (docs) [\#1120](https://github.com/Finschia/finschia-sdk/pull/1120) Update links in x/foundation README.md diff --git a/docs/core/proto-docs.md b/docs/core/proto-docs.md index a01f8940c0..e9718495d8 100644 --- a/docs/core/proto-docs.md +++ b/docs/core/proto-docs.md @@ -856,6 +856,34 @@ - [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) + - [Swapped](#lbm.fswap.v1.Swapped) + +- [lbm/fswap/v1/params.proto](#lbm/fswap/v1/params.proto) + - [Params](#lbm.fswap.v1.Params) + +- [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) + - [QueryTotalSwappableAmountRequest](#lbm.fswap.v1.QueryTotalSwappableAmountRequest) + - [QueryTotalSwappableAmountResponse](#lbm.fswap.v1.QueryTotalSwappableAmountResponse) + + - [Query](#lbm.fswap.v1.Query) + +- [lbm/fswap/v1/tx.proto](#lbm/fswap/v1/tx.proto) + - [MsgSwapAllRequest](#lbm.fswap.v1.MsgSwapAllRequest) + - [MsgSwapAllResponse](#lbm.fswap.v1.MsgSwapAllResponse) + - [MsgSwapRequest](#lbm.fswap.v1.MsgSwapRequest) + - [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) @@ -12683,6 +12711,289 @@ Msg defines the foundation Msg service. + +

Top

+ +## lbm/fswap/v1/event.proto + + + + + +### EventSwapCoins + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `address` | [string](#string) | | holder's address | +| `old_coin_amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | amount of the old currency | +| `new_coin_amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | amount of the new currency | + + + + + + + + + + + + + + + + +

Top

+ +## lbm/fswap/v1/fswap.proto + + + + + +### Swapped + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `old_coin_amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +| `new_coin_amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | + + + + + + + + + + + + + + + + +

Top

+ +## lbm/fswap/v1/params.proto + + + + + +### Params +Params defines the parameters for the module. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `new_coin_denom` | [string](#string) | | new denomination for new coin after swap | + + + + + + + + + + + + + + + + +

Top

+ +## lbm/fswap/v1/genesis.proto + + + + + +### GenesisState +GenesisState defines the fswap module's genesis state. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `params` | [Params](#lbm.fswap.v1.Params) | | | +| `swapped` | [Swapped](#lbm.fswap.v1.Swapped) | | | + + + + + + + + + + + + + + + + +

Top

+ +## lbm/fswap/v1/query.proto + + + + + +### QuerySwappedRequest + + + + + + + + + +### QuerySwappedResponse + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `swapped` | [Swapped](#lbm.fswap.v1.Swapped) | | | + + + + + + + + +### QueryTotalSwappableAmountRequest + + + + + + + + + +### QueryTotalSwappableAmountResponse + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `swappable_new_coin_amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | + + + + + + + + + + + + + + +### Query + + +| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | +| ----------- | ------------ | ------------- | ------------| ------- | -------- | +| `Swapped` | [QuerySwappedRequest](#lbm.fswap.v1.QuerySwappedRequest) | [QuerySwappedResponse](#lbm.fswap.v1.QuerySwappedResponse) | | GET|/lbm/fswap/v1/swapped| +| `TotalNewCurrencySwapLimit` | [QueryTotalSwappableAmountRequest](#lbm.fswap.v1.QueryTotalSwappableAmountRequest) | [QueryTotalSwappableAmountResponse](#lbm.fswap.v1.QueryTotalSwappableAmountResponse) | | GET|/lbm/fswap/v1/swappable_new_coin_amount| + + + + + + +

Top

+ +## lbm/fswap/v1/tx.proto + + + + + +### MsgSwapAllRequest + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `from_address` | [string](#string) | | holder's address | + + + + + + + + +### MsgSwapAllResponse + + + + + + + + + +### MsgSwapRequest + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `from_address` | [string](#string) | | holder's address | +| `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | amount of old currency | + + + + + + + + +### MsgSwapResponse + + + + + + + + + + + + + + + +### Msg + + +| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | +| ----------- | ------------ | ------------- | ------------| ------- | -------- | +| `Swap` | [MsgSwapRequest](#lbm.fswap.v1.MsgSwapRequest) | [MsgSwapResponse](#lbm.fswap.v1.MsgSwapResponse) | | | +| `SwapAll` | [MsgSwapAllRequest](#lbm.fswap.v1.MsgSwapAllRequest) | [MsgSwapAllResponse](#lbm.fswap.v1.MsgSwapAllResponse) | | | + + + + +

Top

diff --git a/go.sum b/go.sum index 33e2a0281b..6d880b970e 100644 --- a/go.sum +++ b/go.sum @@ -134,8 +134,6 @@ github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= github.com/cosmos/gorocksdb v1.2.0 h1:d0l3jJG8M4hBouIZq0mDUHZ+zjOx044J3nGRskwTb4Y= github.com/cosmos/gorocksdb v1.2.0/go.mod h1:aaKvKItm514hKfNJpUJXnnOWeBnk2GL4+Qw9NHizILw= -github.com/cosmos/iavl v0.19.0 h1:sgyrjqOkycXiN7Tuupuo4QAldKFg7Sipyfeg/IL7cps= -github.com/cosmos/iavl v0.19.0/go.mod h1:l5h9pAB3m5fihB3pXVgwYqdY8aBsMagqz7T0MUjxZeA= github.com/cosmos/iavl v0.19.4 h1:t82sN+Y0WeqxDLJRSpNd8YFX5URIrT+p8n6oJbJ2Dok= github.com/cosmos/iavl v0.19.4/go.mod h1:X9PKD3J0iFxdmgNLa7b2LYWdsGd90ToV5cAONApkEPw= github.com/cosmos/keyring v1.1.7-0.20210622111912-ef00f8ac3d76 h1:DdzS1m6o/pCqeZ8VOAit/gyATedRgjvkVI+UCrLpyuU= diff --git a/proto/lbm/fswap/v1/event.proto b/proto/lbm/fswap/v1/event.proto new file mode 100644 index 0000000000..374447f7c3 --- /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; + // amount of the old currency + cosmos.base.v1beta1.Coin old_coin_amount = 2 + [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/Finschia/finschia-sdk/types.Coin"]; + // amount of the new currency + cosmos.base.v1beta1.Coin new_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..827f5f3e32 --- /dev/null +++ b/proto/lbm/fswap/v1/fswap.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 "cosmos/base/v1beta1/coin.proto"; + +message Swapped{ + cosmos.base.v1beta1.Coin old_coin_amount = 1 + [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/Finschia/finschia-sdk/types.Coin"]; + cosmos.base.v1beta1.Coin new_coin_amount = 2 + [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/Finschia/finschia-sdk/types.Coin"]; +} diff --git a/proto/lbm/fswap/v1/genesis.proto b/proto/lbm/fswap/v1/genesis.proto new file mode 100644 index 0000000000..ae0a9ade75 --- /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/params.proto"; +import "lbm/fswap/v1/fswap.proto"; + +// GenesisState defines the fswap module's genesis state. +message GenesisState { + Params params = 1 [(gogoproto.nullable) = false]; + Swapped swapped =2 [(gogoproto.nullable) = false]; +} diff --git a/proto/lbm/fswap/v1/params.proto b/proto/lbm/fswap/v1/params.proto new file mode 100644 index 0000000000..da236c9373 --- /dev/null +++ b/proto/lbm/fswap/v1/params.proto @@ -0,0 +1,13 @@ +syntax = "proto3"; +package lbm.fswap.v1; + +option go_package = "github.com/Finschia/finschia-sdk/x/fswap/types"; + +import "gogoproto/gogo.proto"; + +// Params defines the parameters for the module. +message Params { + option (gogoproto.goproto_stringer) = false; + // new denomination for new coin after swap + string new_coin_denom = 1; +} diff --git a/proto/lbm/fswap/v1/query.proto b/proto/lbm/fswap/v1/query.proto new file mode 100644 index 0000000000..f5d92c7bfc --- /dev/null +++ b/proto/lbm/fswap/v1/query.proto @@ -0,0 +1,29 @@ +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/v1beta1/coin.proto"; +import "lbm/fswap/v1/fswap.proto"; + +service Query { + rpc Swapped(QuerySwappedRequest) returns (QuerySwappedResponse) { + option (google.api.http).get = "/lbm/fswap/v1/swapped"; + } + rpc TotalNewCurrencySwapLimit(QueryTotalSwappableAmountRequest) returns (QueryTotalSwappableAmountResponse) { + option (google.api.http).get = "/lbm/fswap/v1/swappable_new_coin_amount"; + } +} + +message QuerySwappedRequest {} +message QuerySwappedResponse { + Swapped swapped = 1 [(gogoproto.nullable) = false]; +} + +message QueryTotalSwappableAmountRequest {} +message QueryTotalSwappableAmountResponse { + cosmos.base.v1beta1.Coin swappable_new_coin_amount = 1 + [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/Finschia/finschia-sdk/types.Coin"]; +} diff --git a/proto/lbm/fswap/v1/tx.proto b/proto/lbm/fswap/v1/tx.proto new file mode 100644 index 0000000000..c9b3c171bc --- /dev/null +++ b/proto/lbm/fswap/v1/tx.proto @@ -0,0 +1,29 @@ +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(MsgSwapRequest) returns (MsgSwapResponse); + rpc SwapAll(MsgSwapAllRequest) returns (MsgSwapAllResponse); +} + +message MsgSwapRequest { + // holder's address + string from_address = 1; + // amount of old currency + cosmos.base.v1beta1.Coin amount = 2 + [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/Finschia/finschia-sdk/types.Coin"]; +} + +message MsgSwapResponse {} + +message MsgSwapAllRequest { + // holder's address + string from_address = 1; +} + +message MsgSwapAllResponse {} diff --git a/x/ERRORS.md b/x/ERRORS.md index 32ed9ca1b2..c324c8315c 100644 --- a/x/ERRORS.md +++ b/x/ERRORS.md @@ -9,6 +9,7 @@ * [Evidence](#evidence) * [Feegrant](#feegrant) * [Foundation](#foundation) + * [Fswap](#fswap) * [Gov](#gov) * [Params](#params) * [Slashing](#slashing) @@ -172,6 +173,15 @@ >You can also find detailed information in the following Errors.go files: * [foundation/errors.go](foundation/errors.go) +## Fswap + +|Error Name|Codespace|Code|Description| +|:-|:-|:-|:-| +|ErrSample|fswap|1100|sample error| + +>You can also find detailed information in the following Errors.go files: + * [fswap/types/errors.go](fswap/types/errors.go) + ## Gov |Error Name|Codespace|Code|Description| diff --git a/x/fswap/client/cli/query.go b/x/fswap/client/cli/query.go new file mode 100644 index 0000000000..55ec1d2bd1 --- /dev/null +++ b/x/fswap/client/cli/query.go @@ -0,0 +1,79 @@ +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: types.ModuleName, + Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName), + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + cmd.AddCommand( + CmdQuerySwapped(), + CmdQueryTotalSwappableAmount(), + ) + return cmd +} + +func CmdQuerySwapped() *cobra.Command { + cmd := &cobra.Command{ + Use: "fswap swapped", + Short: "shows the current swap status, including both old and new coin amount", + 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.Swapped(cmd.Context(), &types.QuerySwappedRequest{}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + return cmd +} + +func CmdQueryTotalSwappableAmount() *cobra.Command { + cmd := &cobra.Command{ + Use: "fswap total-swappable-amount", + Short: "shows the current total amount of new coin that're swappable", + 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.TotalNewCurrencySwapLimit(cmd.Context(), &types.QueryTotalSwappableAmountRequest{}) + 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..9b2f915ab7 --- /dev/null +++ b/x/fswap/client/cli/tx.go @@ -0,0 +1,95 @@ +package cli + +import ( + "fmt" + "time" + + "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" + "github.com/Finschia/finschia-sdk/x/fswap/types" +) + +var DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds()) + +// 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: "fswap swap [address] [fnsa_amount]", + Short: "swap amounts of old coin to new coin. Note, the'--from' flag is ignored as it is implied from [address].", + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) error { + if err := cmd.Flags().Set(flags.FlagFrom, args[0]); err != nil { + return err + } + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + coin, err := sdk.ParseCoinNormalized(args[2]) + if err != nil { + return err + } + + msg := &types.MsgSwapRequest{ + FromAddress: clientCtx.GetFromAddress().String(), + Amount: coin, + } + 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: "fswap swap-all [address]", + Short: "swap all the old coins. Note, the'--from' flag is ignored as it is implied from [address].", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + if err := cmd.Flags().Set(flags.FlagFrom, args[0]); err != nil { + return err + } + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + msg := &types.MsgSwapAllRequest{ + FromAddress: clientCtx.GetFromAddress().String(), + } + if err := msg.ValidateBasic(); err != nil { + return err + } + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + return cmd +} diff --git a/x/fswap/genesis.go b/x/fswap/genesis.go new file mode 100644 index 0000000000..af232aad36 --- /dev/null +++ b/x/fswap/genesis.go @@ -0,0 +1,24 @@ +package fswap + +import ( + sdk "github.com/Finschia/finschia-sdk/types" + "github.com/Finschia/finschia-sdk/x/fswap/keeper" + "github.com/Finschia/finschia-sdk/x/fswap/types" +) + +// InitGenesis initializes the capability module's state from a provided genesis +// state. +func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { + // this line is used by starport scaffolding # genesis/module/init + k.SetParams(ctx, genState.Params) +} + +// ExportGenesis returns the capability module's exported genesis. +func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { + genesis := types.DefaultGenesis() + genesis.Params = k.GetParams(ctx) + + // this line is used by starport scaffolding # genesis/module/export + + return genesis +} diff --git a/x/fswap/genesis_test.go b/x/fswap/genesis_test.go new file mode 100644 index 0000000000..43bc7afc7c --- /dev/null +++ b/x/fswap/genesis_test.go @@ -0,0 +1 @@ +package fswap_test diff --git a/x/fswap/handler.go b/x/fswap/handler.go new file mode 100644 index 0000000000..2e3dae3f45 --- /dev/null +++ b/x/fswap/handler.go @@ -0,0 +1,26 @@ +package fswap + +import ( + "fmt" + + 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" +) + +// NewHandler ... +func NewHandler(k keeper.Keeper) sdk.Handler { + // this line is used by starport scaffolding # handler/msgServer + + return func(ctx sdk.Context, msg sdk.Msg) (*sdk.Result, error) { + // ctx = ctx.WithEventManager(sdk.NewEventManager()) + + // switch msg := msg.(type) { + // this line is used by starport scaffolding # 1 + // default: + errMsg := fmt.Sprintf("unrecognized %s message type: %T", types.ModuleName, msg) + return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, errMsg) + // } + } +} diff --git a/x/fswap/keeper/grpc_query.go b/x/fswap/keeper/grpc_query.go new file mode 100644 index 0000000000..b55b7c1155 --- /dev/null +++ b/x/fswap/keeper/grpc_query.go @@ -0,0 +1,19 @@ +package keeper + +import ( + "context" + + "github.com/Finschia/finschia-sdk/x/fswap/types" +) + +var _ types.QueryServer = Keeper{} + +// Swapped implements types.QueryServer. +func (k Keeper) Swapped(context.Context, *types.QuerySwappedRequest) (*types.QuerySwappedResponse, error) { + panic("unimplemented") +} + +// TotalNewCurrencySwapLimit implements types.QueryServer. +func (k Keeper) TotalNewCurrencySwapLimit(context.Context, *types.QueryTotalSwappableAmountRequest) (*types.QueryTotalSwappableAmountResponse, error) { + panic("unimplemented") +} diff --git a/x/fswap/keeper/grpc_query_params_test.go b/x/fswap/keeper/grpc_query_params_test.go new file mode 100644 index 0000000000..9429264902 --- /dev/null +++ b/x/fswap/keeper/grpc_query_params_test.go @@ -0,0 +1 @@ +package keeper_test diff --git a/x/fswap/keeper/keeper.go b/x/fswap/keeper/keeper.go new file mode 100644 index 0000000000..329b87cf80 --- /dev/null +++ b/x/fswap/keeper/keeper.go @@ -0,0 +1,39 @@ +package keeper + +import ( + "fmt" + + "github.com/tendermint/tendermint/libs/log" + + "github.com/Finschia/finschia-sdk/codec" + 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 + accountKeeper types.AccountKeeper + bankKeeper types.BankKeeper + storeKey storetypes.StoreKey + } +) + +func NewKeeper( + cdc codec.BinaryCodec, + ak types.AccountKeeper, + bk types.BankKeeper, + storeKey storetypes.StoreKey, +) Keeper { + return Keeper{ + cdc: cdc, + accountKeeper: ak, + bankKeeper: bk, + storeKey: storeKey, + } +} + +func (k Keeper) Logger(ctx sdk.Context) log.Logger { + return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) +} diff --git a/x/fswap/keeper/msg_server.go b/x/fswap/keeper/msg_server.go new file mode 100644 index 0000000000..41b76b832a --- /dev/null +++ b/x/fswap/keeper/msg_server.go @@ -0,0 +1,29 @@ +package keeper + +import ( + "context" + + "github.com/Finschia/finschia-sdk/x/fswap/types" +) + +type msgServer struct { + Keeper +} + +// NewMsgServerImpl returns an implementation of the MsgServer interface +// for the provided Keeper. +func NewMsgServerImpl(keeper Keeper) types.MsgServer { + return &msgServer{Keeper: keeper} +} + +var _ types.MsgServer = msgServer{} + +// Swap implements types.MsgServer. +func (m msgServer) Swap(context.Context, *types.MsgSwapRequest) (*types.MsgSwapResponse, error) { + panic("unimplemented") +} + +// SwapAll implements types.MsgServer. +func (m msgServer) SwapAll(context.Context, *types.MsgSwapAllRequest) (*types.MsgSwapAllResponse, error) { + panic("unimplemented") +} diff --git a/x/fswap/keeper/msg_server_test.go b/x/fswap/keeper/msg_server_test.go new file mode 100644 index 0000000000..9429264902 --- /dev/null +++ b/x/fswap/keeper/msg_server_test.go @@ -0,0 +1 @@ +package keeper_test diff --git a/x/fswap/keeper/params.go b/x/fswap/keeper/params.go new file mode 100644 index 0000000000..5a539d551a --- /dev/null +++ b/x/fswap/keeper/params.go @@ -0,0 +1,16 @@ +package keeper + +import ( + sdk "github.com/Finschia/finschia-sdk/types" + "github.com/Finschia/finschia-sdk/x/fswap/types" +) + +// GetParams get all parameters as types.Params +func (k Keeper) GetParams(ctx sdk.Context) types.Params { + return types.NewParams() +} + +// SetParams set the params +func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { + // k.paramstore.SetParamSet(ctx, ¶ms) +} diff --git a/x/fswap/keeper/params_test.go b/x/fswap/keeper/params_test.go new file mode 100644 index 0000000000..9429264902 --- /dev/null +++ b/x/fswap/keeper/params_test.go @@ -0,0 +1 @@ +package keeper_test diff --git a/x/fswap/keeper/query_params_test.go b/x/fswap/keeper/query_params_test.go new file mode 100644 index 0000000000..9429264902 --- /dev/null +++ b/x/fswap/keeper/query_params_test.go @@ -0,0 +1 @@ +package keeper_test diff --git a/x/fswap/module.go b/x/fswap/module.go new file mode 100644 index 0000000000..0e60e1d03d --- /dev/null +++ b/x/fswap/module.go @@ -0,0 +1,168 @@ +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{} +) + +// ---------------------------------------------------------------------------- +// AppModuleBasic +// ---------------------------------------------------------------------------- + +// AppModuleBasic implements the AppModuleBasic interface for the capability module. +type AppModuleBasic struct { + cdc codec.BinaryCodec +} + +func NewAppModuleBasic(cdc codec.BinaryCodec) AppModuleBasic { + return AppModuleBasic{cdc: cdc} +} + +// Name returns the capability module's name. +func (AppModuleBasic) Name() string { + return types.ModuleName +} + +func (AppModuleBasic) RegisterCodec(cdc *codec.LegacyAmino) { + types.RegisterCodec(cdc) +} + +func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + types.RegisterCodec(cdc) +} + +// RegisterInterfaces registers the module's interface types +func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { + types.RegisterInterfaces(reg) +} + +// DefaultGenesis returns the capability 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 capability module. +func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config 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 capability module's root tx command. +func (a AppModuleBasic) GetTxCmd() *cobra.Command { + return cli.GetTxCmd() +} + +// GetQueryCmd returns the capability module's root query command. +func (AppModuleBasic) GetQueryCmd() *cobra.Command { + return cli.GetQueryCmd(types.StoreKey) +} + +// ---------------------------------------------------------------------------- +// AppModule +// ---------------------------------------------------------------------------- + +// AppModule implements the AppModule interface for the capability module. +type AppModule struct { + AppModuleBasic + + keeper keeper.Keeper + accountKeeper types.AccountKeeper + bankKeeper types.BankKeeper +} + +func NewAppModule( + cdc codec.Codec, + keeper keeper.Keeper, + accountKeeper types.AccountKeeper, + bankKeeper types.BankKeeper, +) AppModule { + return AppModule{ + AppModuleBasic: NewAppModuleBasic(cdc), + keeper: keeper, + accountKeeper: accountKeeper, + bankKeeper: bankKeeper, + } +} + +// Name returns the capability module's name. +func (am AppModule) Name() string { + return am.AppModuleBasic.Name() +} + +// Route returns the capability module's message routing key. +func (am AppModule) Route() sdk.Route { + return sdk.NewRoute(types.RouterKey, NewHandler(am.keeper)) +} + +// QuerierRoute returns the capability module's query routing key. +func (AppModule) QuerierRoute() string { return types.QuerierRoute } + +// LegacyQuerierHandler returns the capability module's Querier. +func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *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(), am.keeper) +} + +// RegisterInvariants registers the capability module's invariants. +func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} + +// InitGenesis performs the capability module's genesis initialization It returns +// no validator updates. +func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.RawMessage) []abci.ValidatorUpdate { + var genState types.GenesisState + // Initialize global index to index in genesis state + cdc.MustUnmarshalJSON(gs, &genState) + + InitGenesis(ctx, am.keeper, genState) + + return []abci.ValidatorUpdate{} +} + +// ExportGenesis returns the capability module's exported genesis state as raw JSON bytes. +func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { + genState := ExportGenesis(ctx, am.keeper) + return cdc.MustMarshalJSON(genState) +} + +// ConsensusVersion implements ConsensusVersion. +func (AppModule) ConsensusVersion() uint64 { return 1 } + +// BeginBlock executes all ABCI BeginBlock logic respective to the capability module. +func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} + +// EndBlock executes all ABCI EndBlock logic respective to the capability 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..48b26e84a0 --- /dev/null +++ b/x/fswap/module_simulation.go @@ -0,0 +1 @@ +package fswap diff --git a/x/fswap/simulation/simap.go b/x/fswap/simulation/simap.go new file mode 100644 index 0000000000..1b74bcd04c --- /dev/null +++ b/x/fswap/simulation/simap.go @@ -0,0 +1,15 @@ +package simulation + +import ( + sdk "github.com/Finschia/finschia-sdk/types" + simtypes "github.com/Finschia/finschia-sdk/types/simulation" +) + +// FindAccount find a specific address from an account list +func FindAccount(accs []simtypes.Account, address string) (simtypes.Account, bool) { + creator, err := sdk.AccAddressFromBech32(address) + if err != nil { + panic(err) + } + return simtypes.FindAccount(accs, creator) +} diff --git a/x/fswap/types/codec.go b/x/fswap/types/codec.go new file mode 100644 index 0000000000..72003233c5 --- /dev/null +++ b/x/fswap/types/codec.go @@ -0,0 +1,23 @@ +package types + +import ( + "github.com/Finschia/finschia-sdk/codec" + cdctypes "github.com/Finschia/finschia-sdk/codec/types" + // this line is used by starport scaffolding # 1 + "github.com/Finschia/finschia-sdk/types/msgservice" +) + +func RegisterCodec(cdc *codec.LegacyAmino) { + // this line is used by starport scaffolding # 2 +} + +func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { + // this line is used by starport scaffolding # 3 + + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) +} + +var ( + Amino = codec.NewLegacyAmino() + ModuleCdc = codec.NewProtoCodec(cdctypes.NewInterfaceRegistry()) +) diff --git a/x/fswap/types/errors.go b/x/fswap/types/errors.go new file mode 100644 index 0000000000..c0b627de88 --- /dev/null +++ b/x/fswap/types/errors.go @@ -0,0 +1,12 @@ +package types + +// DONTCOVER + +import ( + sdkerrors "github.com/Finschia/finschia-sdk/types/errors" +) + +// x/fswap module sentinel errors +var ( + ErrSample = sdkerrors.Register(ModuleName, 1100, "sample error") +) diff --git a/x/fswap/types/event.pb.go b/x/fswap/types/event.pb.go new file mode 100644 index 0000000000..5808cc6e7f --- /dev/null +++ b/x/fswap/types/event.pb.go @@ -0,0 +1,433 @@ +// 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"` + // amount of the old currency + OldCoinAmount types.Coin `protobuf:"bytes,2,opt,name=old_coin_amount,json=oldCoinAmount,proto3,castrepeated=github.com/Finschia/finschia-sdk/types.Coin" json:"old_coin_amount"` + // amount of the new currency + NewCoinAmount types.Coin `protobuf:"bytes,3,opt,name=new_coin_amount,json=newCoinAmount,proto3,castrepeated=github.com/Finschia/finschia-sdk/types.Coin" json:"new_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) GetOldCoinAmount() types.Coin { + if m != nil { + return m.OldCoinAmount + } + return types.Coin{} +} + +func (m *EventSwapCoins) GetNewCoinAmount() types.Coin { + if m != nil { + return m.NewCoinAmount + } + 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{ + // 288 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x91, 0x3f, 0x4e, 0xc3, 0x30, + 0x1c, 0x85, 0xe3, 0x22, 0x81, 0x08, 0xff, 0xa4, 0x88, 0x21, 0x74, 0x70, 0x2b, 0xa6, 0x4a, 0x08, + 0x5b, 0xa1, 0x27, 0xa0, 0x08, 0xc4, 0x5c, 0x36, 0x96, 0xca, 0x4e, 0xdc, 0x34, 0x22, 0xf1, 0x2f, + 0xaa, 0x5d, 0x07, 0x6e, 0xc1, 0xcc, 0x11, 0x38, 0x49, 0xc7, 0x8e, 0x4c, 0x80, 0x92, 0x8b, 0x20, + 0x3b, 0x41, 0x88, 0x89, 0x89, 0xed, 0x59, 0xcf, 0xef, 0xfb, 0x24, 0xdb, 0x0f, 0x73, 0x5e, 0xd0, + 0xb9, 0xaa, 0x58, 0x49, 0x4d, 0x44, 0x85, 0x11, 0x52, 0x93, 0x72, 0x09, 0x1a, 0x82, 0xfd, 0x9c, + 0x17, 0xc4, 0x35, 0xc4, 0x44, 0xfd, 0xe3, 0x14, 0x52, 0x70, 0x05, 0xb5, 0xa9, 0xbd, 0xd3, 0xc7, + 0x31, 0xa8, 0x02, 0x14, 0xe5, 0x4c, 0x09, 0x6a, 0x22, 0x2e, 0x34, 0x8b, 0x68, 0x0c, 0x99, 0x6c, + 0xfb, 0xd3, 0x97, 0x9e, 0x7f, 0x78, 0x6d, 0x99, 0x77, 0x15, 0x2b, 0xaf, 0x20, 0x93, 0x2a, 0x08, + 0xfd, 0x1d, 0x96, 0x24, 0x4b, 0xa1, 0x54, 0x88, 0x86, 0x68, 0xb4, 0x3b, 0xfd, 0x3e, 0x06, 0xc6, + 0x3f, 0x82, 0x3c, 0x99, 0xd9, 0xf9, 0x8c, 0x15, 0xb0, 0x92, 0x3a, 0xec, 0x0d, 0xd1, 0x68, 0xef, + 0xe2, 0x84, 0xb4, 0x1a, 0x62, 0x35, 0xa4, 0xd3, 0x10, 0x8b, 0x9b, 0x8c, 0xd7, 0xef, 0x03, 0xef, + 0xf5, 0x63, 0x70, 0x96, 0x66, 0x7a, 0xb1, 0xe2, 0x24, 0x86, 0x82, 0xde, 0x64, 0x52, 0xc5, 0x8b, + 0x8c, 0xd1, 0x79, 0x17, 0xce, 0x55, 0xf2, 0x40, 0xf5, 0x53, 0x29, 0x94, 0x1b, 0x4d, 0x0f, 0x20, + 0x4f, 0x6c, 0xb8, 0x74, 0x12, 0xeb, 0x95, 0xa2, 0xfa, 0xe5, 0xdd, 0xfa, 0x1f, 0xaf, 0x14, 0xd5, + 0x8f, 0x77, 0x72, 0xbb, 0xae, 0x31, 0xda, 0xd4, 0x18, 0x7d, 0xd6, 0x18, 0x3d, 0x37, 0xd8, 0xdb, + 0x34, 0xd8, 0x7b, 0x6b, 0xb0, 0x77, 0x4f, 0xfe, 0xa4, 0x3e, 0x76, 0x7f, 0xe6, 0xe8, 0x7c, 0xdb, + 0xbd, 0xf6, 0xf8, 0x2b, 0x00, 0x00, 0xff, 0xff, 0x2b, 0x08, 0x6b, 0x7c, 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.NewCoinAmount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintEvent(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size, err := m.OldCoinAmount.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.OldCoinAmount.Size() + n += 1 + l + sovEvent(uint64(l)) + l = m.NewCoinAmount.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 OldCoinAmount", 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.OldCoinAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NewCoinAmount", 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.NewCoinAmount.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/expected_keepers.go b/x/fswap/types/expected_keepers.go new file mode 100644 index 0000000000..6134a117d7 --- /dev/null +++ b/x/fswap/types/expected_keepers.go @@ -0,0 +1,18 @@ +package types + +import ( + sdk "github.com/Finschia/finschia-sdk/types" + "github.com/Finschia/finschia-sdk/x/auth/types" +) + +// AccountKeeper defines the expected account keeper used for simulations (noalias) +type AccountKeeper interface { + GetAccount(ctx sdk.Context, addr sdk.AccAddress) types.AccountI + // Methods imported from account should be defined here +} + +// BankKeeper defines the expected interface needed to retrieve account balances. +type BankKeeper interface { + SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins + // Methods imported from bank should be defined here +} diff --git a/x/fswap/types/fswap.pb.go b/x/fswap/types/fswap.pb.go new file mode 100644 index 0000000000..f53d058797 --- /dev/null +++ b/x/fswap/types/fswap.pb.go @@ -0,0 +1,378 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: lbm/fswap/v1/fswap.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 Swapped struct { + OldCoinAmount types.Coin `protobuf:"bytes,1,opt,name=old_coin_amount,json=oldCoinAmount,proto3,castrepeated=github.com/Finschia/finschia-sdk/types.Coin" json:"old_coin_amount"` + NewCoinAmount types.Coin `protobuf:"bytes,2,opt,name=new_coin_amount,json=newCoinAmount,proto3,castrepeated=github.com/Finschia/finschia-sdk/types.Coin" json:"new_coin_amount"` +} + +func (m *Swapped) Reset() { *m = Swapped{} } +func (m *Swapped) String() string { return proto.CompactTextString(m) } +func (*Swapped) ProtoMessage() {} +func (*Swapped) Descriptor() ([]byte, []int) { + return fileDescriptor_42ca60eaf37a2b67, []int{0} +} +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) GetOldCoinAmount() types.Coin { + if m != nil { + return m.OldCoinAmount + } + return types.Coin{} +} + +func (m *Swapped) GetNewCoinAmount() types.Coin { + if m != nil { + return m.NewCoinAmount + } + return types.Coin{} +} + +func init() { + proto.RegisterType((*Swapped)(nil), "lbm.fswap.v1.Swapped") +} + +func init() { proto.RegisterFile("lbm/fswap/v1/fswap.proto", fileDescriptor_42ca60eaf37a2b67) } + +var fileDescriptor_42ca60eaf37a2b67 = []byte{ + // 262 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xc8, 0x49, 0xca, 0xd5, + 0x4f, 0x2b, 0x2e, 0x4f, 0x2c, 0xd0, 0x2f, 0x33, 0x84, 0x30, 0xf4, 0x0a, 0x8a, 0xf2, 0x4b, 0xf2, + 0x85, 0x78, 0x72, 0x92, 0x72, 0xf5, 0x20, 0x02, 0x65, 0x86, 0x52, 0x22, 0xe9, 0xf9, 0xe9, 0xf9, + 0x60, 0x09, 0x7d, 0x10, 0x0b, 0xa2, 0x46, 0x4a, 0x2e, 0x39, 0xbf, 0x38, 0x37, 0xbf, 0x58, 0x3f, + 0x29, 0xb1, 0x38, 0x55, 0xbf, 0xcc, 0x30, 0x29, 0xb5, 0x24, 0xd1, 0x50, 0x3f, 0x39, 0x3f, 0x33, + 0x0f, 0x22, 0xaf, 0xf4, 0x93, 0x91, 0x8b, 0x3d, 0xb8, 0x3c, 0xb1, 0xa0, 0x20, 0x35, 0x45, 0xa8, + 0x8c, 0x8b, 0x3f, 0x3f, 0x27, 0x25, 0x1e, 0x24, 0x1b, 0x9f, 0x98, 0x9b, 0x5f, 0x9a, 0x57, 0x22, + 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0x6d, 0x24, 0xa9, 0x07, 0x31, 0x45, 0x0f, 0x64, 0x8a, 0x1e, 0xd4, + 0x14, 0x3d, 0xe7, 0xfc, 0xcc, 0x3c, 0x27, 0xe3, 0x13, 0xf7, 0xe4, 0x19, 0x56, 0xdd, 0x97, 0xd7, + 0x4e, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x77, 0xcb, 0xcc, 0x2b, 0x4e, + 0xce, 0xc8, 0x4c, 0xd4, 0x4f, 0x83, 0x32, 0x74, 0x8b, 0x53, 0xb2, 0xf5, 0x4b, 0x2a, 0x0b, 0x52, + 0x8b, 0xc1, 0x9a, 0x82, 0x78, 0xf3, 0x73, 0x52, 0x40, 0x0c, 0x47, 0xb0, 0x25, 0x20, 0x7b, 0xf3, + 0x52, 0xcb, 0x51, 0xec, 0x65, 0xa2, 0x8d, 0xbd, 0x79, 0xa9, 0xe5, 0x08, 0x7b, 0x9d, 0x3c, 0x4e, + 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x09, 0x8f, 0xe5, 0x18, + 0x2e, 0x3c, 0x96, 0x63, 0xb8, 0xf1, 0x58, 0x8e, 0x21, 0x4a, 0x8f, 0xa0, 0xa9, 0x15, 0xd0, 0x28, + 0x01, 0x9b, 0x9e, 0xc4, 0x06, 0x0e, 0x4c, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x5c, 0x78, + 0x6f, 0xce, 0xac, 0x01, 0x00, 0x00, +} + +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.NewCoinAmount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintFswap(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.OldCoinAmount.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 *Swapped) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.OldCoinAmount.Size() + n += 1 + l + sovFswap(uint64(l)) + l = m.NewCoinAmount.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 *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 OldCoinAmount", 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.OldCoinAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NewCoinAmount", 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.NewCoinAmount.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..8df94bae23 --- /dev/null +++ b/x/fswap/types/genesis.go @@ -0,0 +1,24 @@ +package types + +import ( +// this line is used by starport scaffolding # genesis/types/import +) + +// DefaultIndex is the default capability global index +const DefaultIndex uint64 = 1 + +// DefaultGenesis returns the default Capability genesis state +func DefaultGenesis() *GenesisState { + return &GenesisState{ + // this line is used by starport scaffolding # genesis/types/default + Params: DefaultParams(), + } +} + +// Validate performs basic genesis state validation returning an error upon any +// failure. +func (gs GenesisState) Validate() error { + // this line is used by starport scaffolding # genesis/types/validate + + return gs.Params.Validate() +} diff --git a/x/fswap/types/genesis.pb.go b/x/fswap/types/genesis.pb.go new file mode 100644 index 0000000000..af2475beea --- /dev/null +++ b/x/fswap/types/genesis.pb.go @@ -0,0 +1,376 @@ +// 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 { + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` + Swapped Swapped `protobuf:"bytes,2,opt,name=swapped,proto3" json:"swapped"` +} + +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) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +func (m *GenesisState) GetSwapped() Swapped { + if m != nil { + return m.Swapped + } + return Swapped{} +} + +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{ + // 231 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, 0x49, + 0x14, 0xfd, 0x05, 0x89, 0x45, 0x89, 0xb9, 0x50, 0xed, 0x52, 0x12, 0x28, 0x52, 0x10, 0x73, 0xc0, + 0x32, 0x4a, 0x95, 0x5c, 0x3c, 0xee, 0x10, 0x9b, 0x82, 0x4b, 0x12, 0x4b, 0x52, 0x85, 0x8c, 0xb8, + 0xd8, 0x20, 0x3a, 0x25, 0x18, 0x15, 0x18, 0x35, 0xb8, 0x8d, 0x44, 0xf4, 0x90, 0x6d, 0xd6, 0x0b, + 0x00, 0xcb, 0x39, 0xb1, 0x9c, 0xb8, 0x27, 0xcf, 0x10, 0x04, 0x55, 0x29, 0x64, 0xca, 0xc5, 0x0e, + 0x92, 0x2f, 0x48, 0x4d, 0x91, 0x60, 0x02, 0x6b, 0x12, 0x45, 0xd5, 0x14, 0x0c, 0x91, 0x84, 0xea, + 0x82, 0xa9, 0x75, 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, 0xea, 0x9b, 0x92, + 0xca, 0x82, 0xd4, 0xe2, 0x24, 0x36, 0xb0, 0x5f, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x23, + 0x15, 0x87, 0x48, 0x42, 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 + { + size, err := m.Swapped.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 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.Swapped.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 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 Swapped", 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.Swapped.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..e4fa429dc8 --- /dev/null +++ b/x/fswap/types/genesis_test.go @@ -0,0 +1,41 @@ +package types_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + + "github.com/Finschia/finschia-sdk/x/fswap/types" +) + +func TestGenesisState_Validate(t *testing.T) { + for _, tc := range []struct { + desc string + genState *types.GenesisState + valid bool + }{ + { + desc: "default is valid", + genState: types.DefaultGenesis(), + valid: true, + }, + { + desc: "valid genesis state", + genState: &types.GenesisState{ + + // this line is used by starport scaffolding # types/genesis/validField + }, + valid: true, + }, + // this line is used by starport scaffolding # types/genesis/testcase + } { + 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..18047ccfb2 --- /dev/null +++ b/x/fswap/types/keys.go @@ -0,0 +1,22 @@ +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 + + // MemStoreKey defines the in-memory store key + MemStoreKey = "mem_fswap" +) + +func KeyPrefix(p string) []byte { + return []byte(p) +} diff --git a/x/fswap/types/msgs.go b/x/fswap/types/msgs.go new file mode 100644 index 0000000000..4f4ad81cb5 --- /dev/null +++ b/x/fswap/types/msgs.go @@ -0,0 +1,70 @@ +package types + +import ( + sdk "github.com/Finschia/finschia-sdk/types" + sdkerrors "github.com/Finschia/finschia-sdk/types/errors" +) + +var _ sdk.Msg = &MsgSwapRequest{} + +// NewMsgSwapRequest - construct a msg to swap amounts of old coin to new coin +// +//nolint:interfacer +func NewMsgSwapRequest(fromAddr, toAddr sdk.AccAddress, amount sdk.Coin) *MsgSwapRequest { + return &MsgSwapRequest{FromAddress: fromAddr.String(), Amount: amount} +} + +// ValidateBasic Implements Msg. +func (msg MsgSwapRequest) ValidateBasic() error { + _, err := sdk.AccAddressFromBech32(msg.FromAddress) + if err != nil { + return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid address (%s)", err) + } + + if !msg.Amount.IsValid() { + return sdkerrors.Wrap(sdkerrors.ErrInvalidCoins, msg.Amount.String()) + } + + if !msg.Amount.IsPositive() { + return sdkerrors.Wrap(sdkerrors.ErrInvalidCoins, msg.Amount.String()) + } + + return nil +} + +// GetSigners Implements Msg. +func (msg MsgSwapRequest) GetSigners() []sdk.AccAddress { + from, err := sdk.AccAddressFromBech32(msg.FromAddress) + if err != nil { + panic(err) + } + return []sdk.AccAddress{from} +} + +var _ sdk.Msg = &MsgSwapAllRequest{} + +// NewMsgSwapRequest - construct a msg to swap all old coin to new coin +// +//nolint:interfacer +func NewMsgSwapAllRequest(fromAddr, toAddr sdk.AccAddress) *MsgSwapAllRequest { + return &MsgSwapAllRequest{FromAddress: fromAddr.String()} +} + +// ValidateBasic Implements Msg. +func (msg MsgSwapAllRequest) ValidateBasic() error { + _, err := sdk.AccAddressFromBech32(msg.FromAddress) + if err != nil { + return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid address (%s)", err) + } + + return nil +} + +// GetSigners Implements Msg. +func (msg MsgSwapAllRequest) GetSigners() []sdk.AccAddress { + from, err := sdk.AccAddressFromBech32(msg.FromAddress) + if err != nil { + panic(err) + } + return []sdk.AccAddress{from} +} diff --git a/x/fswap/types/params.go b/x/fswap/types/params.go new file mode 100644 index 0000000000..f4b9ae24dc --- /dev/null +++ b/x/fswap/types/params.go @@ -0,0 +1,26 @@ +package types + +import ( + "gopkg.in/yaml.v2" +) + +// NewParams creates a new Params instance +func NewParams() Params { + return Params{} +} + +// DefaultParams returns a default set of parameters +func DefaultParams() Params { + return NewParams() +} + +// Validate validates the set of params +func (p Params) Validate() error { + return nil +} + +// String implements the Stringer interface. +func (p Params) String() string { + out, _ := yaml.Marshal(p) + return string(out) +} diff --git a/x/fswap/types/params.pb.go b/x/fswap/types/params.pb.go new file mode 100644 index 0000000000..fd779ed5a6 --- /dev/null +++ b/x/fswap/types/params.pb.go @@ -0,0 +1,319 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: lbm/fswap/v1/params.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 + +// Params defines the parameters for the module. +type Params struct { + // new denomination for new coin after swap + NewCoinDenom string `protobuf:"bytes,1,opt,name=new_coin_denom,json=newCoinDenom,proto3" json:"new_coin_denom,omitempty"` +} + +func (m *Params) Reset() { *m = Params{} } +func (*Params) ProtoMessage() {} +func (*Params) Descriptor() ([]byte, []int) { + return fileDescriptor_15e620b81032c44d, []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) GetNewCoinDenom() string { + if m != nil { + return m.NewCoinDenom + } + return "" +} + +func init() { + proto.RegisterType((*Params)(nil), "lbm.fswap.v1.Params") +} + +func init() { proto.RegisterFile("lbm/fswap/v1/params.proto", fileDescriptor_15e620b81032c44d) } + +var fileDescriptor_15e620b81032c44d = []byte{ + // 194 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xcc, 0x49, 0xca, 0xd5, + 0x4f, 0x2b, 0x2e, 0x4f, 0x2c, 0xd0, 0x2f, 0x33, 0xd4, 0x2f, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, 0xd6, + 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0xc9, 0x49, 0xca, 0xd5, 0x03, 0x4b, 0xe9, 0x95, 0x19, + 0x4a, 0x89, 0xa4, 0xe7, 0xa7, 0xe7, 0x83, 0x25, 0xf4, 0x41, 0x2c, 0x88, 0x1a, 0x25, 0x13, 0x2e, + 0xb6, 0x00, 0xb0, 0x1e, 0x21, 0x15, 0x2e, 0xbe, 0xbc, 0xd4, 0xf2, 0xf8, 0xe4, 0xfc, 0xcc, 0xbc, + 0xf8, 0x94, 0xd4, 0xbc, 0xfc, 0x5c, 0x09, 0x46, 0x05, 0x46, 0x0d, 0xce, 0x20, 0x9e, 0xbc, 0xd4, + 0x72, 0xe7, 0xfc, 0xcc, 0x3c, 0x17, 0x90, 0x98, 0x15, 0xcb, 0x8c, 0x05, 0xf2, 0x0c, 0x4e, 0x1e, + 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x84, 0xc7, 0x72, + 0x0c, 0x17, 0x1e, 0xcb, 0x31, 0xdc, 0x78, 0x2c, 0xc7, 0x10, 0xa5, 0x97, 0x9e, 0x59, 0x92, 0x51, + 0x9a, 0xa4, 0x97, 0x9c, 0x9f, 0xab, 0xef, 0x96, 0x99, 0x57, 0x9c, 0x9c, 0x91, 0x99, 0xa8, 0x9f, + 0x06, 0x65, 0xe8, 0x16, 0xa7, 0x64, 0xeb, 0x57, 0x40, 0x5d, 0x5b, 0x52, 0x59, 0x90, 0x5a, 0x9c, + 0xc4, 0x06, 0x76, 0x86, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x90, 0xbf, 0xad, 0x40, 0xc7, 0x00, + 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 len(m.NewCoinDenom) > 0 { + i -= len(m.NewCoinDenom) + copy(dAtA[i:], m.NewCoinDenom) + i = encodeVarintParams(dAtA, i, uint64(len(m.NewCoinDenom))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintParams(dAtA []byte, offset int, v uint64) int { + offset -= sovParams(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 = len(m.NewCoinDenom) + if l > 0 { + n += 1 + l + sovParams(uint64(l)) + } + return n +} + +func sovParams(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozParams(x uint64) (n int) { + return sovParams(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 ErrIntOverflowParams + } + 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 NewCoinDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + 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 ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NewCoinDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipParams(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthParams + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipParams(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, ErrIntOverflowParams + } + 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, ErrIntOverflowParams + } + 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, ErrIntOverflowParams + } + 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, ErrInvalidLengthParams + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupParams + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthParams + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthParams = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowParams = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupParams = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/fswap/types/query.pb.go b/x/fswap/types/query.pb.go new file mode 100644 index 0000000000..b3635cf9ad --- /dev/null +++ b/x/fswap/types/query.pb.go @@ -0,0 +1,868 @@ +// 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" + _ "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 { +} + +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 + +type QuerySwappedResponse struct { + Swapped Swapped `protobuf:"bytes,1,opt,name=swapped,proto3" json:"swapped"` +} + +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) GetSwapped() Swapped { + if m != nil { + return m.Swapped + } + return Swapped{} +} + +type QueryTotalSwappableAmountRequest struct { +} + +func (m *QueryTotalSwappableAmountRequest) Reset() { *m = QueryTotalSwappableAmountRequest{} } +func (m *QueryTotalSwappableAmountRequest) String() string { return proto.CompactTextString(m) } +func (*QueryTotalSwappableAmountRequest) ProtoMessage() {} +func (*QueryTotalSwappableAmountRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_01deae9da7816d6a, []int{2} +} +func (m *QueryTotalSwappableAmountRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTotalSwappableAmountRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTotalSwappableAmountRequest.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 *QueryTotalSwappableAmountRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTotalSwappableAmountRequest.Merge(m, src) +} +func (m *QueryTotalSwappableAmountRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryTotalSwappableAmountRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTotalSwappableAmountRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTotalSwappableAmountRequest proto.InternalMessageInfo + +type QueryTotalSwappableAmountResponse struct { + SwappableNewCoinAmount types.Coin `protobuf:"bytes,1,opt,name=swappable_new_coin_amount,json=swappableNewCoinAmount,proto3,castrepeated=github.com/Finschia/finschia-sdk/types.Coin" json:"swappable_new_coin_amount"` +} + +func (m *QueryTotalSwappableAmountResponse) Reset() { *m = QueryTotalSwappableAmountResponse{} } +func (m *QueryTotalSwappableAmountResponse) String() string { return proto.CompactTextString(m) } +func (*QueryTotalSwappableAmountResponse) ProtoMessage() {} +func (*QueryTotalSwappableAmountResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_01deae9da7816d6a, []int{3} +} +func (m *QueryTotalSwappableAmountResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTotalSwappableAmountResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTotalSwappableAmountResponse.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 *QueryTotalSwappableAmountResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTotalSwappableAmountResponse.Merge(m, src) +} +func (m *QueryTotalSwappableAmountResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryTotalSwappableAmountResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTotalSwappableAmountResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTotalSwappableAmountResponse proto.InternalMessageInfo + +func (m *QueryTotalSwappableAmountResponse) GetSwappableNewCoinAmount() types.Coin { + if m != nil { + return m.SwappableNewCoinAmount + } + return types.Coin{} +} + +func init() { + proto.RegisterType((*QuerySwappedRequest)(nil), "lbm.fswap.v1.QuerySwappedRequest") + proto.RegisterType((*QuerySwappedResponse)(nil), "lbm.fswap.v1.QuerySwappedResponse") + proto.RegisterType((*QueryTotalSwappableAmountRequest)(nil), "lbm.fswap.v1.QueryTotalSwappableAmountRequest") + proto.RegisterType((*QueryTotalSwappableAmountResponse)(nil), "lbm.fswap.v1.QueryTotalSwappableAmountResponse") +} + +func init() { proto.RegisterFile("lbm/fswap/v1/query.proto", fileDescriptor_01deae9da7816d6a) } + +var fileDescriptor_01deae9da7816d6a = []byte{ + // 441 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0x41, 0x8b, 0xd3, 0x40, + 0x14, 0xc7, 0x33, 0x8b, 0xba, 0x30, 0x7a, 0x1a, 0xb7, 0xba, 0x0d, 0x9a, 0xdd, 0xcd, 0x45, 0x45, + 0x9c, 0x21, 0xbb, 0xf8, 0x01, 0xac, 0x20, 0x1e, 0x54, 0xb0, 0x7a, 0xf2, 0x52, 0x26, 0xd9, 0xd9, + 0xec, 0x60, 0x32, 0x2f, 0xcd, 0x4c, 0x1a, 0x7b, 0xf5, 0xe6, 0x4d, 0xf0, 0x4b, 0x88, 0x20, 0x7e, + 0x8d, 0x1e, 0x0b, 0x5e, 0x3c, 0xa9, 0xb4, 0x7e, 0x10, 0xc9, 0x64, 0x2a, 0x06, 0x42, 0xf5, 0xf6, + 0x78, 0xef, 0x9f, 0xf9, 0xff, 0xde, 0xff, 0x05, 0xef, 0x67, 0x71, 0xce, 0xce, 0x74, 0xcd, 0x0b, + 0x36, 0x8b, 0xd8, 0xb4, 0x12, 0xe5, 0x9c, 0x16, 0x25, 0x18, 0x20, 0x57, 0xb2, 0x38, 0xa7, 0x76, + 0x42, 0x67, 0x91, 0x7f, 0x23, 0x05, 0x48, 0x33, 0xc1, 0x78, 0x21, 0x19, 0x57, 0x0a, 0x0c, 0x37, + 0x12, 0x94, 0x6e, 0xb5, 0xfe, 0x5e, 0x0a, 0x29, 0xd8, 0x92, 0x35, 0x95, 0xeb, 0x06, 0x09, 0xe8, + 0x1c, 0x34, 0x8b, 0xb9, 0x16, 0x6c, 0x16, 0xc5, 0xc2, 0xf0, 0x88, 0x25, 0x20, 0x95, 0x9b, 0x77, + 0xbd, 0x5b, 0x2b, 0x3b, 0x09, 0x07, 0xf8, 0xea, 0xf3, 0x06, 0xe5, 0x45, 0xcd, 0x8b, 0x42, 0x9c, + 0x8e, 0xc5, 0xb4, 0x12, 0xda, 0x84, 0x4f, 0xf1, 0x5e, 0xb7, 0xad, 0x0b, 0x50, 0x5a, 0x90, 0xfb, + 0x78, 0x57, 0xb7, 0xad, 0x7d, 0x74, 0x88, 0x6e, 0x5f, 0x3e, 0x1e, 0xd0, 0xbf, 0xe1, 0xa9, 0xd3, + 0x8f, 0x2e, 0x2c, 0xbe, 0x1f, 0x78, 0xe3, 0x8d, 0x36, 0x0c, 0xf1, 0xa1, 0x7d, 0xee, 0x25, 0x18, + 0x9e, 0x59, 0x0d, 0x8f, 0x33, 0xf1, 0x20, 0x87, 0x4a, 0x99, 0x8d, 0xe5, 0x17, 0x84, 0x8f, 0xb6, + 0x88, 0x1c, 0xc0, 0x3b, 0x84, 0x87, 0x7a, 0x33, 0x9b, 0x28, 0x51, 0x4f, 0x9a, 0x35, 0x27, 0xdc, + 0xaa, 0x1c, 0xd3, 0x90, 0xb6, 0x71, 0xd0, 0x26, 0x0e, 0xea, 0xe2, 0xa0, 0x0f, 0x41, 0xaa, 0xd1, + 0x49, 0xc3, 0xf5, 0xe9, 0xc7, 0xc1, 0xdd, 0x54, 0x9a, 0xf3, 0x2a, 0xa6, 0x09, 0xe4, 0xec, 0x91, + 0x54, 0x3a, 0x39, 0x97, 0x9c, 0x9d, 0xb9, 0xe2, 0x9e, 0x3e, 0x7d, 0xcd, 0xcc, 0xbc, 0x10, 0xda, + 0x7e, 0x34, 0xbe, 0xf6, 0xc7, 0xf0, 0x99, 0xa8, 0x9b, 0x4e, 0xcb, 0x74, 0xfc, 0x71, 0x07, 0x5f, + 0xb4, 0xc4, 0x04, 0xf0, 0xae, 0xdb, 0x9c, 0x1c, 0x75, 0x03, 0xe9, 0x09, 0xd7, 0x0f, 0xb7, 0x49, + 0xda, 0x3d, 0xc3, 0x9b, 0x6f, 0xbf, 0xfe, 0xfa, 0xb0, 0x73, 0x9d, 0x0c, 0x58, 0xe7, 0x74, 0x2e, + 0x50, 0xf2, 0x19, 0xe1, 0xa1, 0xcd, 0xa9, 0x21, 0xaa, 0xca, 0x52, 0xa8, 0xc4, 0x3e, 0xf1, 0x44, + 0xe6, 0xd2, 0x10, 0xda, 0x63, 0xb0, 0x25, 0x7a, 0x9f, 0xfd, 0xb7, 0xde, 0xd1, 0x31, 0x4b, 0x77, + 0x87, 0xdc, 0xea, 0xa1, 0xeb, 0x3b, 0xcc, 0xe8, 0xf1, 0x62, 0x15, 0xa0, 0xe5, 0x2a, 0x40, 0x3f, + 0x57, 0x01, 0x7a, 0xbf, 0x0e, 0xbc, 0xe5, 0x3a, 0xf0, 0xbe, 0xad, 0x03, 0xef, 0x15, 0xfd, 0xe7, + 0x25, 0xde, 0x38, 0x03, 0x7b, 0x91, 0xf8, 0x92, 0xfd, 0x6f, 0x4f, 0x7e, 0x07, 0x00, 0x00, 0xff, + 0xff, 0xb5, 0xb0, 0x8d, 0x67, 0x4f, 0x03, 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(ctx context.Context, in *QuerySwappedRequest, opts ...grpc.CallOption) (*QuerySwappedResponse, error) + TotalNewCurrencySwapLimit(ctx context.Context, in *QueryTotalSwappableAmountRequest, opts ...grpc.CallOption) (*QueryTotalSwappableAmountResponse, 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) TotalNewCurrencySwapLimit(ctx context.Context, in *QueryTotalSwappableAmountRequest, opts ...grpc.CallOption) (*QueryTotalSwappableAmountResponse, error) { + out := new(QueryTotalSwappableAmountResponse) + err := c.cc.Invoke(ctx, "/lbm.fswap.v1.Query/TotalNewCurrencySwapLimit", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + Swapped(context.Context, *QuerySwappedRequest) (*QuerySwappedResponse, error) + TotalNewCurrencySwapLimit(context.Context, *QueryTotalSwappableAmountRequest) (*QueryTotalSwappableAmountResponse, 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) TotalNewCurrencySwapLimit(ctx context.Context, req *QueryTotalSwappableAmountRequest) (*QueryTotalSwappableAmountResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method TotalNewCurrencySwapLimit 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_TotalNewCurrencySwapLimit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryTotalSwappableAmountRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).TotalNewCurrencySwapLimit(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/lbm.fswap.v1.Query/TotalNewCurrencySwapLimit", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).TotalNewCurrencySwapLimit(ctx, req.(*QueryTotalSwappableAmountRequest)) + } + 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: "TotalNewCurrencySwapLimit", + Handler: _Query_TotalNewCurrencySwapLimit_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 + 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.Swapped.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 *QueryTotalSwappableAmountRequest) 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 *QueryTotalSwappableAmountRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTotalSwappableAmountRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryTotalSwappableAmountResponse) 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 *QueryTotalSwappableAmountResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTotalSwappableAmountResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.SwappableNewCoinAmount.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 + return n +} + +func (m *QuerySwappedResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Swapped.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryTotalSwappableAmountRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryTotalSwappableAmountResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.SwappableNewCoinAmount.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 { + 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 Swapped", 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.Swapped.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 *QueryTotalSwappableAmountRequest) 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: QueryTotalSwappableAmountRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTotalSwappableAmountRequest: 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 *QueryTotalSwappableAmountResponse) 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: QueryTotalSwappableAmountResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTotalSwappableAmountResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SwappableNewCoinAmount", 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.SwappableNewCoinAmount.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..5a63817f6a --- /dev/null +++ b/x/fswap/types/query.pb.gw.go @@ -0,0 +1,210 @@ +// 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 + +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 + + 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 + + msg, err := server.Swapped(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_TotalNewCurrencySwapLimit_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryTotalSwappableAmountRequest + var metadata runtime.ServerMetadata + + msg, err := client.TotalNewCurrencySwapLimit(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_TotalNewCurrencySwapLimit_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryTotalSwappableAmountRequest + var metadata runtime.ServerMetadata + + msg, err := server.TotalNewCurrencySwapLimit(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_TotalNewCurrencySwapLimit_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_TotalNewCurrencySwapLimit_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_TotalNewCurrencySwapLimit_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_TotalNewCurrencySwapLimit_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_TotalNewCurrencySwapLimit_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_TotalNewCurrencySwapLimit_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_TotalNewCurrencySwapLimit_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"lbm", "fswap", "v1", "swappable_new_coin_amount"}, "", runtime.AssumeColonVerbOpt(false))) +) + +var ( + forward_Query_Swapped_0 = runtime.ForwardResponseMessage + + forward_Query_TotalNewCurrencySwapLimit_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..682ec7260b --- /dev/null +++ b/x/fswap/types/tx.pb.go @@ -0,0 +1,913 @@ +// 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 MsgSwapRequest struct { + // holder's address + FromAddress string `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3" json:"from_address,omitempty"` + // amount of old currency + Amount types.Coin `protobuf:"bytes,2,opt,name=amount,proto3,castrepeated=github.com/Finschia/finschia-sdk/types.Coin" json:"amount"` +} + +func (m *MsgSwapRequest) Reset() { *m = MsgSwapRequest{} } +func (m *MsgSwapRequest) String() string { return proto.CompactTextString(m) } +func (*MsgSwapRequest) ProtoMessage() {} +func (*MsgSwapRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_65c77cf1d9b67323, []int{0} +} +func (m *MsgSwapRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSwapRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSwapRequest.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 *MsgSwapRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSwapRequest.Merge(m, src) +} +func (m *MsgSwapRequest) XXX_Size() int { + return m.Size() +} +func (m *MsgSwapRequest) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSwapRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSwapRequest proto.InternalMessageInfo + +func (m *MsgSwapRequest) GetFromAddress() string { + if m != nil { + return m.FromAddress + } + return "" +} + +func (m *MsgSwapRequest) GetAmount() types.Coin { + if m != nil { + return m.Amount + } + return types.Coin{} +} + +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 MsgSwapAllRequest struct { + // holder's address + FromAddress string `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3" json:"from_address,omitempty"` +} + +func (m *MsgSwapAllRequest) Reset() { *m = MsgSwapAllRequest{} } +func (m *MsgSwapAllRequest) String() string { return proto.CompactTextString(m) } +func (*MsgSwapAllRequest) ProtoMessage() {} +func (*MsgSwapAllRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_65c77cf1d9b67323, []int{2} +} +func (m *MsgSwapAllRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSwapAllRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSwapAllRequest.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 *MsgSwapAllRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSwapAllRequest.Merge(m, src) +} +func (m *MsgSwapAllRequest) XXX_Size() int { + return m.Size() +} +func (m *MsgSwapAllRequest) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSwapAllRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSwapAllRequest proto.InternalMessageInfo + +func (m *MsgSwapAllRequest) GetFromAddress() string { + if m != nil { + return m.FromAddress + } + 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((*MsgSwapRequest)(nil), "lbm.fswap.v1.MsgSwapRequest") + proto.RegisterType((*MsgSwapResponse)(nil), "lbm.fswap.v1.MsgSwapResponse") + proto.RegisterType((*MsgSwapAllRequest)(nil), "lbm.fswap.v1.MsgSwapAllRequest") + proto.RegisterType((*MsgSwapAllResponse)(nil), "lbm.fswap.v1.MsgSwapAllResponse") +} + +func init() { proto.RegisterFile("lbm/fswap/v1/tx.proto", fileDescriptor_65c77cf1d9b67323) } + +var fileDescriptor_65c77cf1d9b67323 = []byte{ + // 348 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x52, 0xcd, 0x4a, 0xf3, 0x40, + 0x14, 0xcd, 0x7c, 0x9f, 0x54, 0x9c, 0x16, 0xa5, 0x43, 0x85, 0x1a, 0x34, 0xad, 0x59, 0x15, 0xc4, + 0x19, 0xd2, 0x82, 0xfb, 0xb6, 0x20, 0x2e, 0xec, 0xa6, 0xee, 0xdc, 0x48, 0x92, 0x4e, 0xd2, 0x60, + 0x92, 0x89, 0xbd, 0xd3, 0x1f, 0xdf, 0xc2, 0xa5, 0xe0, 0x1b, 0xf8, 0x24, 0x5d, 0x76, 0xe9, 0x4a, + 0xa5, 0x7d, 0x11, 0x49, 0x26, 0x68, 0x05, 0x8b, 0xee, 0x2e, 0xe7, 0xdc, 0x7b, 0xce, 0xe1, 0xcc, + 0xe0, 0xfd, 0xd0, 0x89, 0x98, 0x07, 0x53, 0x3b, 0x61, 0x13, 0x8b, 0xc9, 0x19, 0x4d, 0x46, 0x42, + 0x0a, 0x52, 0x0a, 0x9d, 0x88, 0x66, 0x30, 0x9d, 0x58, 0x7a, 0xc5, 0x17, 0xbe, 0xc8, 0x08, 0x96, + 0x4e, 0x6a, 0x47, 0x37, 0x5c, 0x01, 0x91, 0x00, 0xe6, 0xd8, 0xc0, 0xd9, 0xc4, 0x72, 0xb8, 0xb4, + 0x2d, 0xe6, 0x8a, 0x20, 0x56, 0xbc, 0xf9, 0x84, 0xf0, 0x6e, 0x0f, 0xfc, 0xab, 0xa9, 0x9d, 0xf4, + 0xf9, 0xdd, 0x98, 0x83, 0x24, 0xc7, 0xb8, 0xe4, 0x8d, 0x44, 0x74, 0x63, 0x0f, 0x06, 0x23, 0x0e, + 0x50, 0x45, 0x75, 0xd4, 0xd8, 0xe9, 0x17, 0x53, 0xac, 0xad, 0x20, 0xe2, 0xe1, 0x82, 0x1d, 0x89, + 0x71, 0x2c, 0xab, 0xff, 0xea, 0xa8, 0x51, 0x6c, 0x1e, 0x50, 0x65, 0x43, 0x53, 0x1b, 0x9a, 0xdb, + 0xd0, 0xae, 0x08, 0xe2, 0x4e, 0x6b, 0xfe, 0x5a, 0xd3, 0x9e, 0xdf, 0x6a, 0x27, 0x7e, 0x20, 0x87, + 0x63, 0x87, 0xba, 0x22, 0x62, 0xe7, 0x41, 0x0c, 0xee, 0x30, 0xb0, 0x99, 0x97, 0x0f, 0xa7, 0x30, + 0xb8, 0x65, 0xf2, 0x3e, 0xe1, 0x90, 0x1d, 0xf5, 0x73, 0x75, 0xb3, 0x8c, 0xf7, 0x3e, 0xc3, 0x41, + 0x22, 0x62, 0xe0, 0xe6, 0x19, 0x2e, 0xe7, 0x50, 0x3b, 0x0c, 0xff, 0x1e, 0xd9, 0xac, 0x60, 0xb2, + 0x7e, 0xa7, 0xd4, 0x9a, 0x8f, 0x08, 0xff, 0xef, 0x81, 0x4f, 0xba, 0x78, 0x2b, 0xa5, 0xc8, 0x21, + 0x5d, 0xef, 0x94, 0x7e, 0x6f, 0x46, 0x3f, 0xda, 0xc0, 0x2a, 0x31, 0x72, 0x89, 0xb7, 0x73, 0x7d, + 0x52, 0xfb, 0x71, 0xf3, 0x2b, 0xb1, 0x5e, 0xdf, 0xbc, 0xa0, 0xd4, 0x3a, 0x17, 0xf3, 0xa5, 0x81, + 0x16, 0x4b, 0x03, 0xbd, 0x2f, 0x0d, 0xf4, 0xb0, 0x32, 0xb4, 0xc5, 0xca, 0xd0, 0x5e, 0x56, 0x86, + 0x76, 0x4d, 0x7f, 0xad, 0x72, 0x96, 0xff, 0x96, 0xac, 0x52, 0xa7, 0x90, 0x3d, 0x75, 0xeb, 0x23, + 0x00, 0x00, 0xff, 0xff, 0xf1, 0x37, 0x1c, 0xc2, 0x47, 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 *MsgSwapRequest, opts ...grpc.CallOption) (*MsgSwapResponse, error) + SwapAll(ctx context.Context, in *MsgSwapAllRequest, 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 *MsgSwapRequest, 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 *MsgSwapAllRequest, 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, *MsgSwapRequest) (*MsgSwapResponse, error) + SwapAll(context.Context, *MsgSwapAllRequest) (*MsgSwapAllResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) Swap(ctx context.Context, req *MsgSwapRequest) (*MsgSwapResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Swap not implemented") +} +func (*UnimplementedMsgServer) SwapAll(ctx context.Context, req *MsgSwapAllRequest) (*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(MsgSwapRequest) + 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.(*MsgSwapRequest)) + } + 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(MsgSwapAllRequest) + 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.(*MsgSwapAllRequest)) + } + 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 *MsgSwapRequest) 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 *MsgSwapRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSwapRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Amount.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 *MsgSwapAllRequest) 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 *MsgSwapAllRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSwapAllRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + 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 *MsgSwapRequest) 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.Amount.Size() + 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 *MsgSwapAllRequest) 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)) + } + 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 *MsgSwapRequest) 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: MsgSwapRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSwapRequest: 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 Amount", 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.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 *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 *MsgSwapAllRequest) 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: MsgSwapAllRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSwapAllRequest: 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 + 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") +) diff --git a/x/fswap/types/types.go b/x/fswap/types/types.go new file mode 100644 index 0000000000..ab1254f4c2 --- /dev/null +++ b/x/fswap/types/types.go @@ -0,0 +1 @@ +package types From 52a3f831542dd0bcd2bd96890b8b543295b57e64 Mon Sep 17 00:00:00 2001 From: 170210 <85928898+170210@users.noreply.github.com> Date: Thu, 25 Apr 2024 17:06:23 +0900 Subject: [PATCH 2/7] 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 --- CHANGELOG.md | 1 + Makefile | 1 + docs/core/proto-docs.md | 15 ++- proto/lbm/fswap/v1/event.proto | 4 +- proto/lbm/fswap/v1/fswap.proto | 10 +- proto/lbm/fswap/v1/genesis.proto | 6 +- proto/lbm/fswap/v1/params.proto | 5 +- proto/lbm/fswap/v1/query.proto | 7 +- simapp/app.go | 14 ++ x/ERRORS.md | 4 +- x/fswap/genesis.go | 24 ---- x/fswap/genesis_test.go | 1 - x/fswap/keeper/fswap.go | 30 +++++ x/fswap/keeper/genesis.go | 25 ++++ x/fswap/keeper/genesis_test.go | 13 ++ x/fswap/keeper/keeper.go | 9 +- x/fswap/keeper/keeper_test.go | 43 +++++++ x/fswap/keeper/params.go | 25 +++- x/fswap/keeper/params_test.go | 1 - x/fswap/module.go | 9 +- x/fswap/module_simulation.go | 38 ++++++ x/fswap/simulation/genesis.go | 65 ++++++++++ x/fswap/simulation/genesis_test.go | 78 +++++++++++ x/fswap/simulation/simap.go | 15 --- x/fswap/testutil/expected_keepers_mocks.go | 101 +++++++++++++++ x/fswap/types/config.go | 24 ++++ x/fswap/types/errors.go | 4 +- x/fswap/types/event.pb.go | 66 +++++----- x/fswap/types/expected_keepers.go | 1 + x/fswap/types/fswap.go | 59 +++++++++ x/fswap/types/fswap.pb.go | 83 +++++------- x/fswap/types/genesis.go | 31 +++-- x/fswap/types/genesis.pb.go | 26 ++-- x/fswap/types/genesis_test.go | 70 +++++++++- x/fswap/types/keys.go | 5 + x/fswap/types/params.go | 15 ++- x/fswap/types/params.pb.go | 62 +++++---- x/fswap/types/query.pb.go | 142 ++++++++++++++------- 38 files changed, 863 insertions(+), 269 deletions(-) delete mode 100644 x/fswap/genesis.go delete mode 100644 x/fswap/genesis_test.go create mode 100644 x/fswap/keeper/fswap.go create mode 100644 x/fswap/keeper/genesis.go create mode 100644 x/fswap/keeper/genesis_test.go create mode 100644 x/fswap/keeper/keeper_test.go delete mode 100644 x/fswap/keeper/params_test.go create mode 100644 x/fswap/simulation/genesis.go create mode 100644 x/fswap/simulation/genesis_test.go delete mode 100644 x/fswap/simulation/simap.go create mode 100644 x/fswap/testutil/expected_keepers_mocks.go create mode 100644 x/fswap/types/config.go create mode 100644 x/fswap/types/fswap.go diff --git a/CHANGELOG.md b/CHANGELOG.md index a88a6c5ca3..8d2bc136b5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -41,6 +41,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Features * (consensus) [\#1178](https://github.com/Finschia/finschia-sdk/pull/1178) change the consensus from Ostracon to Tendermint v0.34.24 * (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 ### Improvements * (docs) [\#1120](https://github.com/Finschia/finschia-sdk/pull/1120) Update links in x/foundation README.md diff --git a/Makefile b/Makefile index 039bdefc1d..fdd954145c 100644 --- a/Makefile +++ b/Makefile @@ -144,6 +144,7 @@ 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/tendermint/tendermint/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 .PHONY: mocks $(MOCKS_DIR): diff --git a/docs/core/proto-docs.md b/docs/core/proto-docs.md index e9718495d8..7d6e8b010d 100644 --- a/docs/core/proto-docs.md +++ b/docs/core/proto-docs.md @@ -12727,8 +12727,8 @@ Msg defines the foundation Msg service. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | `address` | [string](#string) | | holder's address | -| `old_coin_amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | amount of the old currency | -| `new_coin_amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | amount of the new currency | +| `old_coin` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | amount of the old currency | +| `new_coin` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | amount of the new currency | @@ -12759,8 +12759,8 @@ Msg defines the foundation Msg service. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `old_coin_amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | -| `new_coin_amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +| `old_coin_amount` | [string](#string) | | | +| `new_coin_amount` | [string](#string) | | | @@ -12791,7 +12791,7 @@ Params defines the parameters for the module. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `new_coin_denom` | [string](#string) | | new denomination for new coin after swap | +| `swappable_new_coin_amount` | [string](#string) | | | @@ -12864,7 +12864,8 @@ GenesisState defines the fswap module's genesis state. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `swapped` | [Swapped](#lbm.fswap.v1.Swapped) | | | +| `old_coin` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +| `new_coin` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | @@ -12889,7 +12890,7 @@ GenesisState defines the fswap module's genesis state. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `swappable_new_coin_amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +| `swappable_new_coin` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | diff --git a/proto/lbm/fswap/v1/event.proto b/proto/lbm/fswap/v1/event.proto index 374447f7c3..2fea28e9d0 100644 --- a/proto/lbm/fswap/v1/event.proto +++ b/proto/lbm/fswap/v1/event.proto @@ -10,9 +10,9 @@ message EventSwapCoins { // holder's address string address = 1; // amount of the old currency - cosmos.base.v1beta1.Coin old_coin_amount = 2 + cosmos.base.v1beta1.Coin old_coin = 2 [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/Finschia/finschia-sdk/types.Coin"]; // amount of the new currency - cosmos.base.v1beta1.Coin new_coin_amount = 3 + cosmos.base.v1beta1.Coin new_coin = 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 index 827f5f3e32..14315e32d0 100644 --- a/proto/lbm/fswap/v1/fswap.proto +++ b/proto/lbm/fswap/v1/fswap.proto @@ -4,11 +4,9 @@ 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 Swapped{ - cosmos.base.v1beta1.Coin old_coin_amount = 1 - [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/Finschia/finschia-sdk/types.Coin"]; - cosmos.base.v1beta1.Coin new_coin_amount = 2 - [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/Finschia/finschia-sdk/types.Coin"]; +message Swapped { + option (gogoproto.goproto_stringer) = false; + string old_coin_amount = 1 [(gogoproto.customtype) = "github.com/Finschia/finschia-sdk/types.Int", (gogoproto.nullable) = false]; + string new_coin_amount = 2 [(gogoproto.customtype) = "github.com/Finschia/finschia-sdk/types.Int", (gogoproto.nullable) = false]; } diff --git a/proto/lbm/fswap/v1/genesis.proto b/proto/lbm/fswap/v1/genesis.proto index ae0a9ade75..43b639a341 100644 --- a/proto/lbm/fswap/v1/genesis.proto +++ b/proto/lbm/fswap/v1/genesis.proto @@ -4,11 +4,11 @@ package lbm.fswap.v1; option go_package = "github.com/Finschia/finschia-sdk/x/fswap/types"; import "gogoproto/gogo.proto"; -import "lbm/fswap/v1/params.proto"; import "lbm/fswap/v1/fswap.proto"; +import "lbm/fswap/v1/params.proto"; // GenesisState defines the fswap module's genesis state. message GenesisState { - Params params = 1 [(gogoproto.nullable) = false]; - Swapped swapped =2 [(gogoproto.nullable) = false]; + Params params = 1 [(gogoproto.nullable) = false]; + Swapped swapped = 2 [(gogoproto.nullable) = false]; } diff --git a/proto/lbm/fswap/v1/params.proto b/proto/lbm/fswap/v1/params.proto index da236c9373..bc5535afb4 100644 --- a/proto/lbm/fswap/v1/params.proto +++ b/proto/lbm/fswap/v1/params.proto @@ -8,6 +8,5 @@ import "gogoproto/gogo.proto"; // Params defines the parameters for the module. message Params { option (gogoproto.goproto_stringer) = false; - // new denomination for new coin after swap - string new_coin_denom = 1; -} + string swappable_new_coin_amount = 1 [(gogoproto.customtype) = "github.com/Finschia/finschia-sdk/types.Int", (gogoproto.nullable) = false]; +} \ No newline at end of file diff --git a/proto/lbm/fswap/v1/query.proto b/proto/lbm/fswap/v1/query.proto index f5d92c7bfc..5b2e0d02e9 100644 --- a/proto/lbm/fswap/v1/query.proto +++ b/proto/lbm/fswap/v1/query.proto @@ -19,11 +19,14 @@ service Query { message QuerySwappedRequest {} message QuerySwappedResponse { - Swapped swapped = 1 [(gogoproto.nullable) = false]; + cosmos.base.v1beta1.Coin old_coin = 1 + [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/Finschia/finschia-sdk/types.Coin"]; + cosmos.base.v1beta1.Coin new_coin = 2 + [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/Finschia/finschia-sdk/types.Coin"]; } message QueryTotalSwappableAmountRequest {} message QueryTotalSwappableAmountResponse { - cosmos.base.v1beta1.Coin swappable_new_coin_amount = 1 + cosmos.base.v1beta1.Coin swappable_new_coin = 1 [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/Finschia/finschia-sdk/types.Coin"]; } diff --git a/simapp/app.go b/simapp/app.go index a86dd1c611..148cdbc50c 100644 --- a/simapp/app.go +++ b/simapp/app.go @@ -72,6 +72,9 @@ 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" + 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" @@ -138,6 +141,7 @@ var ( vesting.AppModuleBasic{}, tokenmodule.AppModuleBasic{}, collectionmodule.AppModuleBasic{}, + fswap.AppModuleBasic{}, ) // module account permissions @@ -197,6 +201,7 @@ type SimApp struct { ClassKeeper classkeeper.Keeper TokenKeeper tokenkeeper.Keeper CollectionKeeper collectionkeeper.Keeper + FswapKeeper fswapkeeper.Keeper // the module manager mm *module.Manager @@ -250,6 +255,7 @@ func NewSimApp( token.StoreKey, collection.StoreKey, authzkeeper.StoreKey, + fswaptypes.StoreKey, ) tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey) // NOTE: The testingkey is just mounted for testing purposes. Actual applications should @@ -352,6 +358,10 @@ func NewSimApp( // If evidence needs to be handled for the app, set routes in router here and seal app.EvidenceKeeper = *evidenceKeeper + /**** Phase 1 ****/ + fswapConfig := fswaptypes.DefaultConfig() + app.FswapKeeper = fswapkeeper.NewKeeper(appCodec, keys[fswaptypes.StoreKey], app.AccountKeeper, app.BankKeeper, fswapConfig) + /**** Module Options ****/ // NOTE: we may consider parsing `appOpts` inside module constructors. For the moment @@ -383,6 +393,7 @@ 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.AccountKeeper, app.BankKeeper), ) // During begin block slashing happens after distr.BeginBlocker so that @@ -410,6 +421,7 @@ func NewSimApp( vestingtypes.ModuleName, token.ModuleName, collection.ModuleName, + fswaptypes.ModuleName, ) app.mm.SetOrderEndBlockers( crisistypes.ModuleName, @@ -431,6 +443,7 @@ func NewSimApp( foundation.ModuleName, token.ModuleName, collection.ModuleName, + fswaptypes.ModuleName, ) // NOTE: The genutils module must occur after staking so that pools are @@ -458,6 +471,7 @@ func NewSimApp( vestingtypes.ModuleName, token.ModuleName, collection.ModuleName, + fswaptypes.ModuleName, ) // Uncomment if you want to set a custom migration order here. diff --git a/x/ERRORS.md b/x/ERRORS.md index c324c8315c..8ed09149f9 100644 --- a/x/ERRORS.md +++ b/x/ERRORS.md @@ -177,7 +177,9 @@ |Error Name|Codespace|Code|Description| |:-|:-|:-|:-| -|ErrSample|fswap|1100|sample error| +|ErrParamsNotFound|fswap|1100|params does not exist| +|ErrSwappedNotFound|fswap|1101|swapped does not exist| +|ErrExceedSwappable|fswap|1102|exceed swappable coin amount| >You can also find detailed information in the following Errors.go files: * [fswap/types/errors.go](fswap/types/errors.go) diff --git a/x/fswap/genesis.go b/x/fswap/genesis.go deleted file mode 100644 index af232aad36..0000000000 --- a/x/fswap/genesis.go +++ /dev/null @@ -1,24 +0,0 @@ -package fswap - -import ( - sdk "github.com/Finschia/finschia-sdk/types" - "github.com/Finschia/finschia-sdk/x/fswap/keeper" - "github.com/Finschia/finschia-sdk/x/fswap/types" -) - -// InitGenesis initializes the capability module's state from a provided genesis -// state. -func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { - // this line is used by starport scaffolding # genesis/module/init - k.SetParams(ctx, genState.Params) -} - -// ExportGenesis returns the capability module's exported genesis. -func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { - genesis := types.DefaultGenesis() - genesis.Params = k.GetParams(ctx) - - // this line is used by starport scaffolding # genesis/module/export - - return genesis -} diff --git a/x/fswap/genesis_test.go b/x/fswap/genesis_test.go deleted file mode 100644 index 43bc7afc7c..0000000000 --- a/x/fswap/genesis_test.go +++ /dev/null @@ -1 +0,0 @@ -package fswap_test diff --git a/x/fswap/keeper/fswap.go b/x/fswap/keeper/fswap.go new file mode 100644 index 0000000000..6100dfa111 --- /dev/null +++ b/x/fswap/keeper/fswap.go @@ -0,0 +1,30 @@ +package keeper + +import ( + sdk "github.com/Finschia/finschia-sdk/types" + "github.com/Finschia/finschia-sdk/x/fswap/types" +) + +// GetSwapped get all parameters as types.Swapped +func (k Keeper) GetSwapped(ctx sdk.Context) types.Swapped { + store := ctx.KVStore(k.storeKey) + bz := store.Get([]byte{types.SwappedKey}) + var swapped types.Swapped + + if bz == nil { + panic(types.ErrSwappedNotFound) + } + k.cdc.MustUnmarshal(bz, &swapped) + return swapped +} + +// SetSwapped set the types.Swapped +func (k Keeper) SetSwapped(ctx sdk.Context, swapped types.Swapped) error { + store := ctx.KVStore(k.storeKey) + bz, err := k.cdc.Marshal(&swapped) + if err != nil { + return err + } + store.Set([]byte{types.SwappedKey}, bz) + return nil +} diff --git a/x/fswap/keeper/genesis.go b/x/fswap/keeper/genesis.go new file mode 100644 index 0000000000..4cb0edd5e6 --- /dev/null +++ b/x/fswap/keeper/genesis.go @@ -0,0 +1,25 @@ +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) { + if err := k.SetParams(ctx, genState.Params); err != nil { + panic(err) + } + if err := k.SetSwapped(ctx, genState.Swapped); err != nil { + panic(err) + } +} + +// ExportGenesis returns the capability module's exported genesis. +func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { + return &types.GenesisState{ + Params: k.GetParams(ctx), + Swapped: k.GetSwapped(ctx), + } +} diff --git a/x/fswap/keeper/genesis_test.go b/x/fswap/keeper/genesis_test.go new file mode 100644 index 0000000000..ae0e07e275 --- /dev/null +++ b/x/fswap/keeper/genesis_test.go @@ -0,0 +1,13 @@ +package keeper_test + +import ( + "github.com/Finschia/finschia-sdk/x/fswap/types" +) + +func (s *KeeperTestSuite) TestInitAndExportGenesis() { + s.keeper.InitGenesis(s.sdkCtx, *types.DefaultGenesis()) + got := s.keeper.ExportGenesis(s.sdkCtx) + s.Require().NotNil(got) + s.Require().Equal(types.DefaultParams(), got.Params) + s.Require().Equal(types.DefaultSwapped(), got.Swapped) +} diff --git a/x/fswap/keeper/keeper.go b/x/fswap/keeper/keeper.go index 329b87cf80..3036a079e2 100644 --- a/x/fswap/keeper/keeper.go +++ b/x/fswap/keeper/keeper.go @@ -14,23 +14,26 @@ import ( type ( Keeper struct { cdc codec.BinaryCodec + storeKey storetypes.StoreKey accountKeeper types.AccountKeeper bankKeeper types.BankKeeper - storeKey storetypes.StoreKey + config types.Config } ) func NewKeeper( cdc codec.BinaryCodec, + storeKey storetypes.StoreKey, ak types.AccountKeeper, bk types.BankKeeper, - storeKey storetypes.StoreKey, + config types.Config, ) Keeper { return Keeper{ cdc: cdc, + storeKey: storeKey, accountKeeper: ak, bankKeeper: bk, - storeKey: storeKey, + config: config, } } diff --git a/x/fswap/keeper/keeper_test.go b/x/fswap/keeper/keeper_test.go new file mode 100644 index 0000000000..dc87a7e267 --- /dev/null +++ b/x/fswap/keeper/keeper_test.go @@ -0,0 +1,43 @@ +package keeper_test + +import ( + "context" + "testing" + + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/suite" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + + "github.com/Finschia/finschia-sdk/simapp" + sdk "github.com/Finschia/finschia-sdk/types" + "github.com/Finschia/finschia-sdk/x/fswap/keeper" + "github.com/Finschia/finschia-sdk/x/fswap/testutil" + "github.com/Finschia/finschia-sdk/x/fswap/types" +) + +type KeeperTestSuite struct { + suite.Suite + sdkCtx sdk.Context + goCtx context.Context + keeper keeper.Keeper + bankKeeper types.BankKeeper + + msgServer types.MsgServer +} + +func TestKeeperTestSuite(t *testing.T) { + suite.Run(t, new(KeeperTestSuite)) +} + +func (s *KeeperTestSuite) SetupTest() { + ctrl := gomock.NewController(s.T()) + bankKeeper := testutil.NewMockBankKeeper(ctrl) + s.bankKeeper = bankKeeper + checkTx := false + app := simapp.Setup(checkTx) + s.sdkCtx = app.BaseApp.NewContext(checkTx, tmproto.Header{}) + s.goCtx = sdk.WrapSDKContext(s.sdkCtx) + s.keeper = app.FswapKeeper + + s.msgServer = keeper.NewMsgServerImpl(s.keeper) +} diff --git a/x/fswap/keeper/params.go b/x/fswap/keeper/params.go index 5a539d551a..5578a6d760 100644 --- a/x/fswap/keeper/params.go +++ b/x/fswap/keeper/params.go @@ -2,15 +2,34 @@ package keeper import ( sdk "github.com/Finschia/finschia-sdk/types" + sdkerrors "github.com/Finschia/finschia-sdk/types/errors" "github.com/Finschia/finschia-sdk/x/fswap/types" ) // GetParams get all parameters as types.Params func (k Keeper) GetParams(ctx sdk.Context) types.Params { - return types.NewParams() + store := ctx.KVStore(k.storeKey) + bz := store.Get([]byte{types.ParamsKey}) + var params types.Params + if bz == nil { + panic(sdkerrors.ErrNotFound) + } + k.cdc.MustUnmarshal(bz, ¶ms) + return params } // SetParams set the params -func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { - // k.paramstore.SetParamSet(ctx, ¶ms) +func (k Keeper) SetParams(ctx sdk.Context, params types.Params) error { + store := ctx.KVStore(k.storeKey) + bz, err := k.cdc.Marshal(¶ms) + if err != nil { + return err + } + store.Set([]byte{types.ParamsKey}, bz) + return nil +} + +func (k Keeper) SwappableNewCoinAmount(ctx sdk.Context) sdk.Int { + params := k.GetParams(ctx) + return params.SwappableNewCoinAmount } diff --git a/x/fswap/keeper/params_test.go b/x/fswap/keeper/params_test.go deleted file mode 100644 index 9429264902..0000000000 --- a/x/fswap/keeper/params_test.go +++ /dev/null @@ -1 +0,0 @@ -package keeper_test diff --git a/x/fswap/module.go b/x/fswap/module.go index 0e60e1d03d..724b883a9e 100644 --- a/x/fswap/module.go +++ b/x/fswap/module.go @@ -19,8 +19,9 @@ import ( ) var ( - _ module.AppModule = AppModule{} - _ module.AppModuleBasic = AppModuleBasic{} + _ module.AppModule = AppModule{} + _ module.AppModuleBasic = AppModuleBasic{} + _ module.EndBlockAppModule = AppModule{} ) // ---------------------------------------------------------------------------- @@ -144,14 +145,14 @@ func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.Ra // Initialize global index to index in genesis state cdc.MustUnmarshalJSON(gs, &genState) - InitGenesis(ctx, am.keeper, genState) + am.keeper.InitGenesis(ctx, genState) return []abci.ValidatorUpdate{} } // ExportGenesis returns the capability module's exported genesis state as raw JSON bytes. func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { - genState := ExportGenesis(ctx, am.keeper) + genState := am.keeper.ExportGenesis(ctx) return cdc.MustMarshalJSON(genState) } diff --git a/x/fswap/module_simulation.go b/x/fswap/module_simulation.go index 48b26e84a0..4748931d47 100644 --- a/x/fswap/module_simulation.go +++ b/x/fswap/module_simulation.go @@ -1 +1,39 @@ 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/simulation" +) + +var _ module.AppModuleSimulation = AppModule{} + +// GenerateGenesisState creates a randomized GenState of the module. +func (AppModule) GenerateGenesisState(simState *module.SimulationState) { + simulation.RandomizedGenState(simState) +} + +// 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/simulation/genesis.go b/x/fswap/simulation/genesis.go new file mode 100644 index 0000000000..f84ff0b243 --- /dev/null +++ b/x/fswap/simulation/genesis.go @@ -0,0 +1,65 @@ +package simulation + +import ( + "encoding/json" + "fmt" + "math/rand" + + sdk "github.com/Finschia/finschia-sdk/types" + "github.com/Finschia/finschia-sdk/types/module" + "github.com/Finschia/finschia-sdk/x/fswap/types" +) + +// Simulation parameter constants +const ( + OldCoinAmount = "old_coin_amount" + NewCoinAmount = "new_coin_amount" + SwappableNewCoinAmount = "swappable_new_coin_amount" +) + +// GenOldCoinAmount randomized oldCoinAmount +func GenOldCoinAmount(r *rand.Rand) sdk.Int { + return sdk.NewInt(int64(r.Intn(1001) + 1000)) +} + +// GenNewCoinAmount randomized oldCoinAmount +func GenNewCoinAmount(r *rand.Rand) sdk.Int { + return sdk.NewInt(int64(r.Intn(100001) + 100000)) +} + +// GenSwappableNewCoinAmount randomized swappableNewCoinAmount +func GenSwappableNewCoinAmount(r *rand.Rand) sdk.Int { + return sdk.NewInt(int64(r.Intn(100001) + 200000)) +} + +// RandomizedGenState generates a random GenesisState for fswap +func RandomizedGenState(simState *module.SimulationState) { + var oldCoinAmount sdk.Int + simState.AppParams.GetOrGenerate( + simState.Cdc, OldCoinAmount, &oldCoinAmount, simState.Rand, + func(r *rand.Rand) { oldCoinAmount = GenOldCoinAmount(r) }, + ) + + var newCoinAmount sdk.Int + simState.AppParams.GetOrGenerate( + simState.Cdc, NewCoinAmount, &newCoinAmount, simState.Rand, + func(r *rand.Rand) { newCoinAmount = GenNewCoinAmount(r) }, + ) + + var swappableNewCoinAmount sdk.Int + simState.AppParams.GetOrGenerate( + simState.Cdc, SwappableNewCoinAmount, &swappableNewCoinAmount, simState.Rand, + func(r *rand.Rand) { swappableNewCoinAmount = GenSwappableNewCoinAmount(r) }, + ) + + fswapParams := types.NewParams(swappableNewCoinAmount) + fswapSwapped := types.NewSwapped(oldCoinAmount, newCoinAmount) + fswapGenesis := types.NewGenesisState(fswapParams, fswapSwapped) + + bz, err := json.MarshalIndent(&fswapGenesis, "", " ") + if err != nil { + panic(err) + } + fmt.Printf("Selected randomly generated fswap parameters:\n%s\n", bz) + simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(fswapGenesis) +} diff --git a/x/fswap/simulation/genesis_test.go b/x/fswap/simulation/genesis_test.go new file mode 100644 index 0000000000..00ac1852d7 --- /dev/null +++ b/x/fswap/simulation/genesis_test.go @@ -0,0 +1,78 @@ +package simulation_test + +import ( + "encoding/json" + "math/rand" + "testing" + + "github.com/stretchr/testify/require" + + "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" + simtypes "github.com/Finschia/finschia-sdk/types/simulation" + "github.com/Finschia/finschia-sdk/x/fswap/simulation" + "github.com/Finschia/finschia-sdk/x/fswap/types" +) + +// TestRandomizedGenState tests the normal scenario of applying RandomizedGenState. +// Abonormal scenarios are not tested here. +func TestRandomizedGenState(t *testing.T) { + interfaceRegistry := codectypes.NewInterfaceRegistry() + cdc := codec.NewProtoCodec(interfaceRegistry) + + s := rand.NewSource(1) + r := rand.New(s) + + simState := module.SimulationState{ + AppParams: make(simtypes.AppParams), + Cdc: cdc, + Rand: r, + NumBonded: 3, + Accounts: simtypes.RandomAccounts(r, 3), + InitialStake: 1000, + GenState: make(map[string]json.RawMessage), + } + + simulation.RandomizedGenState(&simState) + + var fswapGenesis types.GenesisState + + int1 := sdk.NewInt(296839) + int2 := sdk.NewInt(1754) + int3 := sdk.NewInt(138374) + simState.Cdc.MustUnmarshalJSON(simState.GenState[types.ModuleName], &fswapGenesis) + require.Equal(t, int1, fswapGenesis.Params.SwappableNewCoinAmount) + require.Equal(t, int2, fswapGenesis.Swapped.OldCoinAmount) + require.Equal(t, int3, fswapGenesis.Swapped.NewCoinAmount) +} + +// TestRandomizedGenState tests abnormal scenarios of applying RandomizedGenState. +func TestRandomizedGenState1(t *testing.T) { + interfaceRegistry := codectypes.NewInterfaceRegistry() + cdc := codec.NewProtoCodec(interfaceRegistry) + + s := rand.NewSource(1) + r := rand.New(s) + // all these tests will panic + tests := []struct { + simState module.SimulationState + panicMsg string + }{ + { // panic => reason: incomplete initialization of the simState + module.SimulationState{}, "invalid memory address or nil pointer dereference"}, + { // panic => reason: incomplete initialization of the simState + module.SimulationState{ + AppParams: make(simtypes.AppParams), + Cdc: cdc, + Rand: r, + }, "assignment to entry in nil map"}, + } + + for _, tt := range tests { + tt := tt + + require.Panicsf(t, func() { simulation.RandomizedGenState(&tt.simState) }, tt.panicMsg) + } +} diff --git a/x/fswap/simulation/simap.go b/x/fswap/simulation/simap.go deleted file mode 100644 index 1b74bcd04c..0000000000 --- a/x/fswap/simulation/simap.go +++ /dev/null @@ -1,15 +0,0 @@ -package simulation - -import ( - sdk "github.com/Finschia/finschia-sdk/types" - simtypes "github.com/Finschia/finschia-sdk/types/simulation" -) - -// FindAccount find a specific address from an account list -func FindAccount(accs []simtypes.Account, address string) (simtypes.Account, bool) { - creator, err := sdk.AccAddressFromBech32(address) - if err != nil { - panic(err) - } - return simtypes.FindAccount(accs, creator) -} diff --git a/x/fswap/testutil/expected_keepers_mocks.go b/x/fswap/testutil/expected_keepers_mocks.go new file mode 100644 index 0000000000..21bb92feaf --- /dev/null +++ b/x/fswap/testutil/expected_keepers_mocks.go @@ -0,0 +1,101 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: x/fswap/types/expected_keepers.go + +// Package testutil is a generated GoMock package. +package testutil + +import ( + reflect "reflect" + + types "github.com/Finschia/finschia-sdk/types" + types0 "github.com/Finschia/finschia-sdk/x/auth/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 +} + +// GetAccount mocks base method. +func (m *MockAccountKeeper) GetAccount(ctx types.Context, addr types.AccAddress) types0.AccountI { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetAccount", ctx, addr) + ret0, _ := ret[0].(types0.AccountI) + return ret0 +} + +// GetAccount indicates an expected call of GetAccount. +func (mr *MockAccountKeeperMockRecorder) GetAccount(ctx, addr interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAccount", reflect.TypeOf((*MockAccountKeeper)(nil).GetAccount), ctx, addr) +} + +// 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 +} + +// GetSupply mocks base method. +func (m *MockBankKeeper) GetSupply(ctx types.Context, denom string) types.Coin { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetSupply", ctx, denom) + ret0, _ := ret[0].(types.Coin) + return ret0 +} + +// GetSupply indicates an expected call of GetSupply. +func (mr *MockBankKeeperMockRecorder) GetSupply(ctx, denom interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSupply", reflect.TypeOf((*MockBankKeeper)(nil).GetSupply), ctx, denom) +} + +// SpendableCoins mocks base method. +func (m *MockBankKeeper) SpendableCoins(ctx types.Context, addr types.AccAddress) types.Coins { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SpendableCoins", ctx, addr) + ret0, _ := ret[0].(types.Coins) + return ret0 +} + +// SpendableCoins indicates an expected call of SpendableCoins. +func (mr *MockBankKeeperMockRecorder) SpendableCoins(ctx, addr interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SpendableCoins", reflect.TypeOf((*MockBankKeeper)(nil).SpendableCoins), ctx, addr) +} diff --git a/x/fswap/types/config.go b/x/fswap/types/config.go new file mode 100644 index 0000000000..d2e57a05aa --- /dev/null +++ b/x/fswap/types/config.go @@ -0,0 +1,24 @@ +package types + +import ( + sdk "github.com/Finschia/finschia-sdk/types" +) + +// Config is a config struct used for intialising the fswap module to avoid using globals. +type Config struct { + // OldCoinDenom defines the old coin denom. + OldCoinDenom string + // NewCoinDenom defines the new coin denom. + NewCoinDenom string + // SwapRate defines the swap rate. + SwapRate sdk.Int +} + +// DefaultConfig returns the default config for fswap. +func DefaultConfig() Config { + return Config{ + OldCoinDenom: "cony", + NewCoinDenom: "PDT", + SwapRate: sdk.NewInt(148079656000000), + } +} diff --git a/x/fswap/types/errors.go b/x/fswap/types/errors.go index c0b627de88..3a18f66f20 100644 --- a/x/fswap/types/errors.go +++ b/x/fswap/types/errors.go @@ -8,5 +8,7 @@ import ( // x/fswap module sentinel errors var ( - ErrSample = sdkerrors.Register(ModuleName, 1100, "sample error") + ErrParamsNotFound = sdkerrors.Register(ModuleName, 1100, "params does not exist") + ErrSwappedNotFound = sdkerrors.Register(ModuleName, 1101, "swapped does not exist") + ErrExceedSwappable = sdkerrors.Register(ModuleName, 1102, "exceed swappable coin amount") ) diff --git a/x/fswap/types/event.pb.go b/x/fswap/types/event.pb.go index 5808cc6e7f..d3e5284230 100644 --- a/x/fswap/types/event.pb.go +++ b/x/fswap/types/event.pb.go @@ -28,9 +28,9 @@ type EventSwapCoins struct { // holder's address Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // amount of the old currency - OldCoinAmount types.Coin `protobuf:"bytes,2,opt,name=old_coin_amount,json=oldCoinAmount,proto3,castrepeated=github.com/Finschia/finschia-sdk/types.Coin" json:"old_coin_amount"` + OldCoin types.Coin `protobuf:"bytes,2,opt,name=old_coin,json=oldCoin,proto3,castrepeated=github.com/Finschia/finschia-sdk/types.Coin" json:"old_coin"` // amount of the new currency - NewCoinAmount types.Coin `protobuf:"bytes,3,opt,name=new_coin_amount,json=newCoinAmount,proto3,castrepeated=github.com/Finschia/finschia-sdk/types.Coin" json:"new_coin_amount"` + NewCoin types.Coin `protobuf:"bytes,3,opt,name=new_coin,json=newCoin,proto3,castrepeated=github.com/Finschia/finschia-sdk/types.Coin" json:"new_coin"` } func (m *EventSwapCoins) Reset() { *m = EventSwapCoins{} } @@ -73,16 +73,16 @@ func (m *EventSwapCoins) GetAddress() string { return "" } -func (m *EventSwapCoins) GetOldCoinAmount() types.Coin { +func (m *EventSwapCoins) GetOldCoin() types.Coin { if m != nil { - return m.OldCoinAmount + return m.OldCoin } return types.Coin{} } -func (m *EventSwapCoins) GetNewCoinAmount() types.Coin { +func (m *EventSwapCoins) GetNewCoin() types.Coin { if m != nil { - return m.NewCoinAmount + return m.NewCoin } return types.Coin{} } @@ -94,25 +94,25 @@ func init() { func init() { proto.RegisterFile("lbm/fswap/v1/event.proto", fileDescriptor_92d5edbd64a725af) } var fileDescriptor_92d5edbd64a725af = []byte{ - // 288 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x91, 0x3f, 0x4e, 0xc3, 0x30, - 0x1c, 0x85, 0xe3, 0x22, 0x81, 0x08, 0xff, 0xa4, 0x88, 0x21, 0x74, 0x70, 0x2b, 0xa6, 0x4a, 0x08, - 0x5b, 0xa1, 0x27, 0xa0, 0x08, 0xc4, 0x5c, 0x36, 0x96, 0xca, 0x4e, 0xdc, 0x34, 0x22, 0xf1, 0x2f, - 0xaa, 0x5d, 0x07, 0x6e, 0xc1, 0xcc, 0x11, 0x38, 0x49, 0xc7, 0x8e, 0x4c, 0x80, 0x92, 0x8b, 0x20, - 0x3b, 0x41, 0x88, 0x89, 0x89, 0xed, 0x59, 0xcf, 0xef, 0xfb, 0x24, 0xdb, 0x0f, 0x73, 0x5e, 0xd0, - 0xb9, 0xaa, 0x58, 0x49, 0x4d, 0x44, 0x85, 0x11, 0x52, 0x93, 0x72, 0x09, 0x1a, 0x82, 0xfd, 0x9c, - 0x17, 0xc4, 0x35, 0xc4, 0x44, 0xfd, 0xe3, 0x14, 0x52, 0x70, 0x05, 0xb5, 0xa9, 0xbd, 0xd3, 0xc7, - 0x31, 0xa8, 0x02, 0x14, 0xe5, 0x4c, 0x09, 0x6a, 0x22, 0x2e, 0x34, 0x8b, 0x68, 0x0c, 0x99, 0x6c, - 0xfb, 0xd3, 0x97, 0x9e, 0x7f, 0x78, 0x6d, 0x99, 0x77, 0x15, 0x2b, 0xaf, 0x20, 0x93, 0x2a, 0x08, - 0xfd, 0x1d, 0x96, 0x24, 0x4b, 0xa1, 0x54, 0x88, 0x86, 0x68, 0xb4, 0x3b, 0xfd, 0x3e, 0x06, 0xc6, - 0x3f, 0x82, 0x3c, 0x99, 0xd9, 0xf9, 0x8c, 0x15, 0xb0, 0x92, 0x3a, 0xec, 0x0d, 0xd1, 0x68, 0xef, - 0xe2, 0x84, 0xb4, 0x1a, 0x62, 0x35, 0xa4, 0xd3, 0x10, 0x8b, 0x9b, 0x8c, 0xd7, 0xef, 0x03, 0xef, - 0xf5, 0x63, 0x70, 0x96, 0x66, 0x7a, 0xb1, 0xe2, 0x24, 0x86, 0x82, 0xde, 0x64, 0x52, 0xc5, 0x8b, - 0x8c, 0xd1, 0x79, 0x17, 0xce, 0x55, 0xf2, 0x40, 0xf5, 0x53, 0x29, 0x94, 0x1b, 0x4d, 0x0f, 0x20, - 0x4f, 0x6c, 0xb8, 0x74, 0x12, 0xeb, 0x95, 0xa2, 0xfa, 0xe5, 0xdd, 0xfa, 0x1f, 0xaf, 0x14, 0xd5, - 0x8f, 0x77, 0x72, 0xbb, 0xae, 0x31, 0xda, 0xd4, 0x18, 0x7d, 0xd6, 0x18, 0x3d, 0x37, 0xd8, 0xdb, - 0x34, 0xd8, 0x7b, 0x6b, 0xb0, 0x77, 0x4f, 0xfe, 0xa4, 0x3e, 0x76, 0x7f, 0xe6, 0xe8, 0x7c, 0xdb, - 0xbd, 0xf6, 0xf8, 0x2b, 0x00, 0x00, 0xff, 0xff, 0x2b, 0x08, 0x6b, 0x7c, 0xcd, 0x01, 0x00, 0x00, + // 278 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x91, 0xb1, 0x4e, 0xc3, 0x30, + 0x10, 0x86, 0xe3, 0x22, 0x51, 0x08, 0x88, 0xa1, 0x62, 0x08, 0x1d, 0xdc, 0x8a, 0xa9, 0x12, 0xc2, + 0x56, 0xe8, 0x1b, 0x80, 0x40, 0xcc, 0x65, 0x63, 0x41, 0x76, 0xe2, 0xa6, 0x16, 0x89, 0x2f, 0xea, + 0x99, 0x04, 0x36, 0x1e, 0x81, 0xe7, 0xe0, 0x49, 0x3a, 0x76, 0x64, 0x02, 0x94, 0xbc, 0x08, 0xb2, + 0x13, 0x66, 0x26, 0xb6, 0xff, 0xf4, 0xdf, 0xff, 0xfd, 0xd2, 0x5d, 0x18, 0xe5, 0xb2, 0xe0, 0x4b, + 0xac, 0x45, 0xc9, 0xab, 0x98, 0xab, 0x4a, 0x19, 0xcb, 0xca, 0x35, 0x58, 0x18, 0x1d, 0xe6, 0xb2, + 0x60, 0xde, 0x61, 0x55, 0x3c, 0x3e, 0xce, 0x20, 0x03, 0x6f, 0x70, 0xa7, 0xba, 0x9d, 0x31, 0x4d, + 0x00, 0x0b, 0x40, 0x2e, 0x05, 0x2a, 0x5e, 0xc5, 0x52, 0x59, 0x11, 0xf3, 0x04, 0xb4, 0xe9, 0xfc, + 0xd3, 0xd7, 0x41, 0x78, 0x74, 0xed, 0x98, 0x77, 0xb5, 0x28, 0xaf, 0x40, 0x1b, 0x1c, 0x45, 0xe1, + 0x50, 0xa4, 0xe9, 0x5a, 0x21, 0x46, 0x64, 0x4a, 0x66, 0xfb, 0x8b, 0xdf, 0x71, 0xa4, 0xc3, 0x3d, + 0xc8, 0xd3, 0x07, 0x17, 0x8f, 0x06, 0x53, 0x32, 0x3b, 0xb8, 0x38, 0x61, 0x1d, 0x9f, 0x39, 0x3e, + 0xeb, 0xf9, 0xcc, 0x71, 0x2e, 0xe7, 0x9b, 0xcf, 0x49, 0xf0, 0xfe, 0x35, 0x39, 0xcb, 0xb4, 0x5d, + 0x3d, 0x49, 0x96, 0x40, 0xc1, 0x6f, 0xb4, 0xc1, 0x64, 0xa5, 0x05, 0x5f, 0xf6, 0xe2, 0x1c, 0xd3, + 0x47, 0x6e, 0x5f, 0x4a, 0x85, 0x3e, 0xb4, 0x18, 0x42, 0x9e, 0x3a, 0xe1, 0xaa, 0x8c, 0xaa, 0xbb, + 0xaa, 0x9d, 0xff, 0xa9, 0x32, 0xaa, 0xf6, 0xe9, 0xdb, 0x4d, 0x43, 0xc9, 0xb6, 0xa1, 0xe4, 0xbb, + 0xa1, 0xe4, 0xad, 0xa5, 0xc1, 0xb6, 0xa5, 0xc1, 0x47, 0x4b, 0x83, 0x7b, 0xf6, 0x27, 0xef, 0xb9, + 0xff, 0x8c, 0xe7, 0xca, 0x5d, 0x7f, 0xd3, 0xf9, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xb7, 0x1e, + 0x90, 0x67, 0xb3, 0x01, 0x00, 0x00, } func (m *EventSwapCoins) Marshal() (dAtA []byte, err error) { @@ -136,7 +136,7 @@ func (m *EventSwapCoins) MarshalToSizedBuffer(dAtA []byte) (int, error) { var l int _ = l { - size, err := m.NewCoinAmount.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.NewCoin.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -146,7 +146,7 @@ func (m *EventSwapCoins) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x1a { - size, err := m.OldCoinAmount.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.OldCoin.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -186,9 +186,9 @@ func (m *EventSwapCoins) Size() (n int) { if l > 0 { n += 1 + l + sovEvent(uint64(l)) } - l = m.OldCoinAmount.Size() + l = m.OldCoin.Size() n += 1 + l + sovEvent(uint64(l)) - l = m.NewCoinAmount.Size() + l = m.NewCoin.Size() n += 1 + l + sovEvent(uint64(l)) return n } @@ -262,7 +262,7 @@ func (m *EventSwapCoins) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OldCoinAmount", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field OldCoin", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -289,13 +289,13 @@ func (m *EventSwapCoins) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.OldCoinAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.OldCoin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NewCoinAmount", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field NewCoin", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -322,7 +322,7 @@ func (m *EventSwapCoins) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.NewCoinAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.NewCoin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/fswap/types/expected_keepers.go b/x/fswap/types/expected_keepers.go index 6134a117d7..195cd89bdc 100644 --- a/x/fswap/types/expected_keepers.go +++ b/x/fswap/types/expected_keepers.go @@ -15,4 +15,5 @@ type AccountKeeper interface { type BankKeeper interface { SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins // Methods imported from bank should be defined here + GetSupply(ctx sdk.Context, denom string) sdk.Coin } diff --git a/x/fswap/types/fswap.go b/x/fswap/types/fswap.go new file mode 100644 index 0000000000..76803ed5f3 --- /dev/null +++ b/x/fswap/types/fswap.go @@ -0,0 +1,59 @@ +package types + +import ( + fmt "fmt" + + "gopkg.in/yaml.v2" + + sdk "github.com/Finschia/finschia-sdk/types" +) + +// NewSwapped creates a new Swapped instance +func NewSwapped( + oldCoinAmount sdk.Int, + newCoinAmount sdk.Int, +) Swapped { + return Swapped{ + OldCoinAmount: oldCoinAmount, + NewCoinAmount: newCoinAmount, + } +} + +// DefaultSwapped returns an initial Swapped object +func DefaultSwapped() Swapped { + return NewSwapped(sdk.ZeroInt(), sdk.ZeroInt()) +} + +func validateCoinAmount(i interface{}) error { + v, ok := i.(sdk.Int) + if !ok { + return fmt.Errorf("invalid coin amount: %T", i) + } + + if v.IsNil() { + return fmt.Errorf("coin amount must be not nil") + } + + if v.LT(sdk.ZeroInt()) { + return fmt.Errorf("coin amount cannot be lower than 0") + } + + return nil +} + +// Validate validates the set of swapped +func (s Swapped) Validate() error { + if err := validateCoinAmount(s.OldCoinAmount); err != nil { + return err + } + if err := validateCoinAmount(s.NewCoinAmount); err != nil { + return err + } + 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 index f53d058797..1923c31269 100644 --- a/x/fswap/types/fswap.pb.go +++ b/x/fswap/types/fswap.pb.go @@ -5,7 +5,7 @@ package types import ( fmt "fmt" - types "github.com/Finschia/finschia-sdk/types" + 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" @@ -25,13 +25,12 @@ var _ = math.Inf const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type Swapped struct { - OldCoinAmount types.Coin `protobuf:"bytes,1,opt,name=old_coin_amount,json=oldCoinAmount,proto3,castrepeated=github.com/Finschia/finschia-sdk/types.Coin" json:"old_coin_amount"` - NewCoinAmount types.Coin `protobuf:"bytes,2,opt,name=new_coin_amount,json=newCoinAmount,proto3,castrepeated=github.com/Finschia/finschia-sdk/types.Coin" json:"new_coin_amount"` + OldCoinAmount github_com_Finschia_finschia_sdk_types.Int `protobuf:"bytes,1,opt,name=old_coin_amount,json=oldCoinAmount,proto3,customtype=github.com/Finschia/finschia-sdk/types.Int" json:"old_coin_amount"` + NewCoinAmount github_com_Finschia_finschia_sdk_types.Int `protobuf:"bytes,2,opt,name=new_coin_amount,json=newCoinAmount,proto3,customtype=github.com/Finschia/finschia-sdk/types.Int" json:"new_coin_amount"` } -func (m *Swapped) Reset() { *m = Swapped{} } -func (m *Swapped) String() string { return proto.CompactTextString(m) } -func (*Swapped) ProtoMessage() {} +func (m *Swapped) Reset() { *m = Swapped{} } +func (*Swapped) ProtoMessage() {} func (*Swapped) Descriptor() ([]byte, []int) { return fileDescriptor_42ca60eaf37a2b67, []int{0} } @@ -62,20 +61,6 @@ func (m *Swapped) XXX_DiscardUnknown() { var xxx_messageInfo_Swapped proto.InternalMessageInfo -func (m *Swapped) GetOldCoinAmount() types.Coin { - if m != nil { - return m.OldCoinAmount - } - return types.Coin{} -} - -func (m *Swapped) GetNewCoinAmount() types.Coin { - if m != nil { - return m.NewCoinAmount - } - return types.Coin{} -} - func init() { proto.RegisterType((*Swapped)(nil), "lbm.fswap.v1.Swapped") } @@ -83,24 +68,22 @@ func init() { func init() { proto.RegisterFile("lbm/fswap/v1/fswap.proto", fileDescriptor_42ca60eaf37a2b67) } var fileDescriptor_42ca60eaf37a2b67 = []byte{ - // 262 bytes of a gzipped FileDescriptorProto + // 230 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xc8, 0x49, 0xca, 0xd5, 0x4f, 0x2b, 0x2e, 0x4f, 0x2c, 0xd0, 0x2f, 0x33, 0x84, 0x30, 0xf4, 0x0a, 0x8a, 0xf2, 0x4b, 0xf2, 0x85, 0x78, 0x72, 0x92, 0x72, 0xf5, 0x20, 0x02, 0x65, 0x86, 0x52, 0x22, 0xe9, 0xf9, 0xe9, 0xf9, - 0x60, 0x09, 0x7d, 0x10, 0x0b, 0xa2, 0x46, 0x4a, 0x2e, 0x39, 0xbf, 0x38, 0x37, 0xbf, 0x58, 0x3f, - 0x29, 0xb1, 0x38, 0x55, 0xbf, 0xcc, 0x30, 0x29, 0xb5, 0x24, 0xd1, 0x50, 0x3f, 0x39, 0x3f, 0x33, - 0x0f, 0x22, 0xaf, 0xf4, 0x93, 0x91, 0x8b, 0x3d, 0xb8, 0x3c, 0xb1, 0xa0, 0x20, 0x35, 0x45, 0xa8, - 0x8c, 0x8b, 0x3f, 0x3f, 0x27, 0x25, 0x1e, 0x24, 0x1b, 0x9f, 0x98, 0x9b, 0x5f, 0x9a, 0x57, 0x22, - 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0x6d, 0x24, 0xa9, 0x07, 0x31, 0x45, 0x0f, 0x64, 0x8a, 0x1e, 0xd4, - 0x14, 0x3d, 0xe7, 0xfc, 0xcc, 0x3c, 0x27, 0xe3, 0x13, 0xf7, 0xe4, 0x19, 0x56, 0xdd, 0x97, 0xd7, - 0x4e, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x77, 0xcb, 0xcc, 0x2b, 0x4e, - 0xce, 0xc8, 0x4c, 0xd4, 0x4f, 0x83, 0x32, 0x74, 0x8b, 0x53, 0xb2, 0xf5, 0x4b, 0x2a, 0x0b, 0x52, - 0x8b, 0xc1, 0x9a, 0x82, 0x78, 0xf3, 0x73, 0x52, 0x40, 0x0c, 0x47, 0xb0, 0x25, 0x20, 0x7b, 0xf3, - 0x52, 0xcb, 0x51, 0xec, 0x65, 0xa2, 0x8d, 0xbd, 0x79, 0xa9, 0xe5, 0x08, 0x7b, 0x9d, 0x3c, 0x4e, - 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x09, 0x8f, 0xe5, 0x18, - 0x2e, 0x3c, 0x96, 0x63, 0xb8, 0xf1, 0x58, 0x8e, 0x21, 0x4a, 0x8f, 0xa0, 0xa9, 0x15, 0xd0, 0x28, - 0x01, 0x9b, 0x9e, 0xc4, 0x06, 0x0e, 0x4c, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x5c, 0x78, - 0x6f, 0xce, 0xac, 0x01, 0x00, 0x00, + 0x60, 0x09, 0x7d, 0x10, 0x0b, 0xa2, 0x46, 0xe9, 0x38, 0x23, 0x17, 0x7b, 0x70, 0x79, 0x62, 0x41, + 0x41, 0x6a, 0x8a, 0x50, 0x14, 0x17, 0x7f, 0x7e, 0x4e, 0x4a, 0x7c, 0x72, 0x7e, 0x66, 0x5e, 0x7c, + 0x62, 0x6e, 0x7e, 0x69, 0x5e, 0x89, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0xa7, 0x93, 0xd1, 0x89, 0x7b, + 0xf2, 0x0c, 0xb7, 0xee, 0xc9, 0x6b, 0xa5, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, + 0xea, 0xbb, 0x65, 0xe6, 0x15, 0x27, 0x67, 0x64, 0x26, 0xea, 0xa7, 0x41, 0x19, 0xba, 0xc5, 0x29, + 0xd9, 0xfa, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x7a, 0x9e, 0x79, 0x25, 0x41, 0xbc, 0xf9, 0x39, 0x29, + 0xce, 0xf9, 0x99, 0x79, 0x8e, 0x60, 0x83, 0x40, 0x66, 0xe7, 0xa5, 0x96, 0xa3, 0x98, 0xcd, 0x44, + 0xbe, 0xd9, 0x79, 0xa9, 0xe5, 0x08, 0xb3, 0xad, 0x58, 0x66, 0x2c, 0x90, 0x67, 0x70, 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, 0x3d, 0x82, 0x46, 0x57, 0x40, 0x03, + 0x10, 0x6c, 0x45, 0x12, 0x1b, 0x38, 0x68, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x82, 0xb7, + 0x84, 0x0e, 0x5a, 0x01, 0x00, 0x00, } func (m *Swapped) Marshal() (dAtA []byte, err error) { @@ -124,21 +107,21 @@ func (m *Swapped) MarshalToSizedBuffer(dAtA []byte) (int, error) { var l int _ = l { - size, err := m.NewCoinAmount.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { + size := m.NewCoinAmount.Size() + i -= size + if _, err := m.NewCoinAmount.MarshalTo(dAtA[i:]); err != nil { return 0, err } - i -= size i = encodeVarintFswap(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x12 { - size, err := m.OldCoinAmount.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { + size := m.OldCoinAmount.Size() + i -= size + if _, err := m.OldCoinAmount.MarshalTo(dAtA[i:]); err != nil { return 0, err } - i -= size i = encodeVarintFswap(dAtA, i, uint64(size)) } i-- @@ -209,7 +192,7 @@ func (m *Swapped) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field OldCoinAmount", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowFswap @@ -219,15 +202,16 @@ func (m *Swapped) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthFswap } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthFswap } @@ -242,7 +226,7 @@ func (m *Swapped) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field NewCoinAmount", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowFswap @@ -252,15 +236,16 @@ func (m *Swapped) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthFswap } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthFswap } diff --git a/x/fswap/types/genesis.go b/x/fswap/types/genesis.go index 8df94bae23..816ef241d0 100644 --- a/x/fswap/types/genesis.go +++ b/x/fswap/types/genesis.go @@ -1,24 +1,29 @@ package types -import ( -// this line is used by starport scaffolding # genesis/types/import -) - -// DefaultIndex is the default capability global index -const DefaultIndex uint64 = 1 +// NewGenesis creates a new genesis state +func NewGenesisState(params Params, swapped Swapped) *GenesisState { + return &GenesisState{ + Params: params, + Swapped: swapped, + } +} // DefaultGenesis returns the default Capability genesis state func DefaultGenesis() *GenesisState { - return &GenesisState{ - // this line is used by starport scaffolding # genesis/types/default - Params: DefaultParams(), - } + return NewGenesisState(DefaultParams(), DefaultSwapped()) } // Validate performs basic genesis state validation returning an error upon any // failure. func (gs GenesisState) Validate() error { - // this line is used by starport scaffolding # genesis/types/validate - - return gs.Params.Validate() + if err := gs.Params.Validate(); err != nil { + return err + } + if err := gs.Swapped.Validate(); err != nil { + return err + } + if gs.Params.SwappableNewCoinAmount.LT(gs.Swapped.NewCoinAmount) { + return ErrExceedSwappable + } + return nil } diff --git a/x/fswap/types/genesis.pb.go b/x/fswap/types/genesis.pb.go index af2475beea..5b76f03a14 100644 --- a/x/fswap/types/genesis.pb.go +++ b/x/fswap/types/genesis.pb.go @@ -83,22 +83,22 @@ func init() { func init() { proto.RegisterFile("lbm/fswap/v1/genesis.proto", fileDescriptor_94e309cb1db27661) } var fileDescriptor_94e309cb1db27661 = []byte{ - // 231 bytes of a gzipped FileDescriptorProto + // 230 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, 0x49, - 0x14, 0xfd, 0x05, 0x89, 0x45, 0x89, 0xb9, 0x50, 0xed, 0x52, 0x12, 0x28, 0x52, 0x10, 0x73, 0xc0, - 0x32, 0x4a, 0x95, 0x5c, 0x3c, 0xee, 0x10, 0x9b, 0x82, 0x4b, 0x12, 0x4b, 0x52, 0x85, 0x8c, 0xb8, - 0xd8, 0x20, 0x3a, 0x25, 0x18, 0x15, 0x18, 0x35, 0xb8, 0x8d, 0x44, 0xf4, 0x90, 0x6d, 0xd6, 0x0b, - 0x00, 0xcb, 0x39, 0xb1, 0x9c, 0xb8, 0x27, 0xcf, 0x10, 0x04, 0x55, 0x29, 0x64, 0xca, 0xc5, 0x0e, - 0x92, 0x2f, 0x48, 0x4d, 0x91, 0x60, 0x02, 0x6b, 0x12, 0x45, 0xd5, 0x14, 0x0c, 0x91, 0x84, 0xea, - 0x82, 0xa9, 0x75, 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, 0xea, 0x9b, 0x92, - 0xca, 0x82, 0xd4, 0xe2, 0x24, 0x36, 0xb0, 0x5f, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x23, - 0x15, 0x87, 0x48, 0x42, 0x01, 0x00, 0x00, + 0x19, 0x4a, 0x89, 0xa4, 0xe7, 0xa7, 0xe7, 0x83, 0x25, 0xf4, 0x41, 0x2c, 0x88, 0x1a, 0x29, 0x09, + 0x14, 0xfd, 0x10, 0xc5, 0x10, 0x19, 0x49, 0x14, 0x99, 0x82, 0xc4, 0xa2, 0xc4, 0x5c, 0xa8, 0xc1, + 0x4a, 0x95, 0x5c, 0x3c, 0xee, 0x10, 0x9b, 0x82, 0x4b, 0x12, 0x4b, 0x52, 0x85, 0x8c, 0xb8, 0xd8, + 0x20, 0xf2, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0xdc, 0x46, 0x22, 0x7a, 0xc8, 0x36, 0xeb, 0x05, 0x80, + 0xe5, 0x9c, 0x58, 0x4e, 0xdc, 0x93, 0x67, 0x08, 0x82, 0xaa, 0x14, 0x32, 0xe5, 0x62, 0x07, 0xc9, + 0x17, 0xa4, 0xa6, 0x48, 0x30, 0x81, 0x35, 0x89, 0xa2, 0x6a, 0x0a, 0x86, 0x48, 0x42, 0x75, 0xc1, + 0xd4, 0x3a, 0x79, 0x9c, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, + 0x13, 0x1e, 0xcb, 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x5e, 0x7a, + 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0xbe, 0x5b, 0x66, 0x5e, 0x71, 0x72, 0x46, + 0x66, 0xa2, 0x7e, 0x1a, 0x94, 0xa1, 0x5b, 0x9c, 0x92, 0xad, 0x5f, 0x01, 0xf5, 0x4e, 0x49, 0x65, + 0x41, 0x6a, 0x71, 0x12, 0x1b, 0xd8, 0x2f, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0xcb, 0xd0, + 0xcc, 0x0f, 0x42, 0x01, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { diff --git a/x/fswap/types/genesis_test.go b/x/fswap/types/genesis_test.go index e4fa429dc8..15394d1ac0 100644 --- a/x/fswap/types/genesis_test.go +++ b/x/fswap/types/genesis_test.go @@ -5,10 +5,11 @@ import ( "github.com/stretchr/testify/require" + sdk "github.com/Finschia/finschia-sdk/types" "github.com/Finschia/finschia-sdk/x/fswap/types" ) -func TestGenesisState_Validate(t *testing.T) { +func TestGenesisStateValidate(t *testing.T) { for _, tc := range []struct { desc string genState *types.GenesisState @@ -20,14 +21,71 @@ func TestGenesisState_Validate(t *testing.T) { valid: true, }, { - desc: "valid genesis state", + desc: "empty genesisState", + genState: &types.GenesisState{}, + valid: false, + }, + { + desc: "empty params", genState: &types.GenesisState{ - - // this line is used by starport scaffolding # types/genesis/validField + Swapped: types.DefaultSwapped(), + }, + valid: false, + }, + { + desc: "empty swapped", + genState: &types.GenesisState{ + Params: types.DefaultParams(), + }, + valid: false, + }, + { + desc: "empty swappableNewCoinAmount in params", + genState: &types.GenesisState{ + Params: types.Params{}, + Swapped: types.DefaultSwapped(), + }, + valid: false, + }, + { + desc: "empty oldCoin in Swapped", + genState: &types.GenesisState{ + Params: types.DefaultParams(), + Swapped: types.Swapped{ + NewCoinAmount: sdk.ZeroInt(), + }, + }, + valid: false, + }, + { + desc: "empty newCoin in Swapped", + genState: &types.GenesisState{ + Params: types.DefaultParams(), + Swapped: types.Swapped{ + OldCoinAmount: sdk.ZeroInt(), + }, + }, + valid: false, + }, + { + desc: "coinAmount is negative", + genState: &types.GenesisState{ + Params: types.DefaultParams(), + Swapped: types.Swapped{ + NewCoinAmount: sdk.ZeroInt(), + OldCoinAmount: sdk.NewInt(-1), + }, + }, + valid: false, + }, + { + desc: "swappable coin exceed", + genState: &types.GenesisState{ + Params: types.NewParams(sdk.NewInt(1000)), + Swapped: types.NewSwapped(sdk.NewInt(1000), sdk.NewInt(100000)), }, - valid: true, + valid: false, }, - // this line is used by starport scaffolding # types/genesis/testcase } { t.Run(tc.desc, func(t *testing.T) { err := tc.genState.Validate() diff --git a/x/fswap/types/keys.go b/x/fswap/types/keys.go index 18047ccfb2..a13045fad7 100644 --- a/x/fswap/types/keys.go +++ b/x/fswap/types/keys.go @@ -17,6 +17,11 @@ const ( MemStoreKey = "mem_fswap" ) +var ( + ParamsKey = byte(0x00) + SwappedKey = byte(0x01) +) + func KeyPrefix(p string) []byte { return []byte(p) } diff --git a/x/fswap/types/params.go b/x/fswap/types/params.go index f4b9ae24dc..fbfedf3534 100644 --- a/x/fswap/types/params.go +++ b/x/fswap/types/params.go @@ -2,20 +2,29 @@ package types import ( "gopkg.in/yaml.v2" + + sdk "github.com/Finschia/finschia-sdk/types" ) // NewParams creates a new Params instance -func NewParams() Params { - return Params{} +func NewParams( + swappableNewCoinAmount sdk.Int, +) Params { + return Params{ + SwappableNewCoinAmount: swappableNewCoinAmount, + } } // DefaultParams returns a default set of parameters func DefaultParams() Params { - return NewParams() + return NewParams(sdk.ZeroInt()) } // Validate validates the set of params func (p Params) Validate() error { + if err := validateCoinAmount(p.SwappableNewCoinAmount); err != nil { + return err + } return nil } diff --git a/x/fswap/types/params.pb.go b/x/fswap/types/params.pb.go index fd779ed5a6..8e9887228b 100644 --- a/x/fswap/types/params.pb.go +++ b/x/fswap/types/params.pb.go @@ -5,6 +5,7 @@ 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" @@ -25,8 +26,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // Params defines the parameters for the module. type Params struct { - // new denomination for new coin after swap - NewCoinDenom string `protobuf:"bytes,1,opt,name=new_coin_denom,json=newCoinDenom,proto3" json:"new_coin_denom,omitempty"` + SwappableNewCoinAmount github_com_Finschia_finschia_sdk_types.Int `protobuf:"bytes,1,opt,name=swappable_new_coin_amount,json=swappableNewCoinAmount,proto3,customtype=github.com/Finschia/finschia-sdk/types.Int" json:"swappable_new_coin_amount"` } func (m *Params) Reset() { *m = Params{} } @@ -61,13 +61,6 @@ func (m *Params) XXX_DiscardUnknown() { var xxx_messageInfo_Params proto.InternalMessageInfo -func (m *Params) GetNewCoinDenom() string { - if m != nil { - return m.NewCoinDenom - } - return "" -} - func init() { proto.RegisterType((*Params)(nil), "lbm.fswap.v1.Params") } @@ -75,20 +68,22 @@ func init() { func init() { proto.RegisterFile("lbm/fswap/v1/params.proto", fileDescriptor_15e620b81032c44d) } var fileDescriptor_15e620b81032c44d = []byte{ - // 194 bytes of a gzipped FileDescriptorProto + // 225 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xcc, 0x49, 0xca, 0xd5, 0x4f, 0x2b, 0x2e, 0x4f, 0x2c, 0xd0, 0x2f, 0x33, 0xd4, 0x2f, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0xc9, 0x49, 0xca, 0xd5, 0x03, 0x4b, 0xe9, 0x95, 0x19, - 0x4a, 0x89, 0xa4, 0xe7, 0xa7, 0xe7, 0x83, 0x25, 0xf4, 0x41, 0x2c, 0x88, 0x1a, 0x25, 0x13, 0x2e, - 0xb6, 0x00, 0xb0, 0x1e, 0x21, 0x15, 0x2e, 0xbe, 0xbc, 0xd4, 0xf2, 0xf8, 0xe4, 0xfc, 0xcc, 0xbc, - 0xf8, 0x94, 0xd4, 0xbc, 0xfc, 0x5c, 0x09, 0x46, 0x05, 0x46, 0x0d, 0xce, 0x20, 0x9e, 0xbc, 0xd4, - 0x72, 0xe7, 0xfc, 0xcc, 0x3c, 0x17, 0x90, 0x98, 0x15, 0xcb, 0x8c, 0x05, 0xf2, 0x0c, 0x4e, 0x1e, - 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x84, 0xc7, 0x72, - 0x0c, 0x17, 0x1e, 0xcb, 0x31, 0xdc, 0x78, 0x2c, 0xc7, 0x10, 0xa5, 0x97, 0x9e, 0x59, 0x92, 0x51, - 0x9a, 0xa4, 0x97, 0x9c, 0x9f, 0xab, 0xef, 0x96, 0x99, 0x57, 0x9c, 0x9c, 0x91, 0x99, 0xa8, 0x9f, - 0x06, 0x65, 0xe8, 0x16, 0xa7, 0x64, 0xeb, 0x57, 0x40, 0x5d, 0x5b, 0x52, 0x59, 0x90, 0x5a, 0x9c, - 0xc4, 0x06, 0x76, 0x86, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x90, 0xbf, 0xad, 0x40, 0xc7, 0x00, - 0x00, 0x00, + 0x4a, 0x89, 0xa4, 0xe7, 0xa7, 0xe7, 0x83, 0x25, 0xf4, 0x41, 0x2c, 0x88, 0x1a, 0xa5, 0x5a, 0x2e, + 0xb6, 0x00, 0xb0, 0x1e, 0xa1, 0x5c, 0x2e, 0x49, 0x90, 0xd2, 0x82, 0xc4, 0xa4, 0x9c, 0xd4, 0xf8, + 0xbc, 0xd4, 0xf2, 0xf8, 0xe4, 0xfc, 0xcc, 0xbc, 0xf8, 0xc4, 0xdc, 0xfc, 0xd2, 0xbc, 0x12, 0x09, + 0x46, 0x05, 0x46, 0x0d, 0x4e, 0x27, 0xa3, 0x13, 0xf7, 0xe4, 0x19, 0x6e, 0xdd, 0x93, 0xd7, 0x4a, + 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x77, 0xcb, 0xcc, 0x2b, 0x4e, 0xce, + 0xc8, 0x4c, 0xd4, 0x4f, 0x83, 0x32, 0x74, 0x8b, 0x53, 0xb2, 0xf5, 0x4b, 0x2a, 0x0b, 0x52, 0x8b, + 0xf5, 0x3c, 0xf3, 0x4a, 0x82, 0xc4, 0xe0, 0x86, 0xfa, 0xa5, 0x96, 0x3b, 0xe7, 0x67, 0xe6, 0x39, + 0x82, 0x4d, 0xb4, 0x62, 0x99, 0xb1, 0x40, 0x9e, 0xc1, 0xc9, 0xe3, 0xc4, 0x23, 0x39, 0xc6, 0x0b, + 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x9c, 0xf0, 0x58, 0x8e, 0xe1, 0xc2, 0x63, 0x39, 0x86, + 0x1b, 0x8f, 0xe5, 0x18, 0xa2, 0xf4, 0x08, 0xda, 0x51, 0x01, 0xf5, 0x36, 0xd8, 0xae, 0x24, 0x36, + 0xb0, 0x7f, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x53, 0xb6, 0x13, 0xee, 0x10, 0x01, 0x00, + 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -111,13 +106,16 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.NewCoinDenom) > 0 { - i -= len(m.NewCoinDenom) - copy(dAtA[i:], m.NewCoinDenom) - i = encodeVarintParams(dAtA, i, uint64(len(m.NewCoinDenom))) - i-- - dAtA[i] = 0xa + { + size := m.SwappableNewCoinAmount.Size() + i -= size + if _, err := m.SwappableNewCoinAmount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintParams(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0xa return len(dAtA) - i, nil } @@ -138,10 +136,8 @@ func (m *Params) Size() (n int) { } var l int _ = l - l = len(m.NewCoinDenom) - if l > 0 { - n += 1 + l + sovParams(uint64(l)) - } + l = m.SwappableNewCoinAmount.Size() + n += 1 + l + sovParams(uint64(l)) return n } @@ -182,7 +178,7 @@ func (m *Params) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NewCoinDenom", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field SwappableNewCoinAmount", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -210,7 +206,9 @@ func (m *Params) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.NewCoinDenom = string(dAtA[iNdEx:postIndex]) + if err := m.SwappableNewCoinAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex diff --git a/x/fswap/types/query.pb.go b/x/fswap/types/query.pb.go index b3635cf9ad..67643e704b 100644 --- a/x/fswap/types/query.pb.go +++ b/x/fswap/types/query.pb.go @@ -67,7 +67,8 @@ func (m *QuerySwappedRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QuerySwappedRequest proto.InternalMessageInfo type QuerySwappedResponse struct { - Swapped Swapped `protobuf:"bytes,1,opt,name=swapped,proto3" json:"swapped"` + OldCoin types.Coin `protobuf:"bytes,1,opt,name=old_coin,json=oldCoin,proto3,castrepeated=github.com/Finschia/finschia-sdk/types.Coin" json:"old_coin"` + NewCoin types.Coin `protobuf:"bytes,2,opt,name=new_coin,json=newCoin,proto3,castrepeated=github.com/Finschia/finschia-sdk/types.Coin" json:"new_coin"` } func (m *QuerySwappedResponse) Reset() { *m = QuerySwappedResponse{} } @@ -103,11 +104,18 @@ func (m *QuerySwappedResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QuerySwappedResponse proto.InternalMessageInfo -func (m *QuerySwappedResponse) GetSwapped() Swapped { +func (m *QuerySwappedResponse) GetOldCoin() types.Coin { if m != nil { - return m.Swapped + return m.OldCoin } - return Swapped{} + return types.Coin{} +} + +func (m *QuerySwappedResponse) GetNewCoin() types.Coin { + if m != nil { + return m.NewCoin + } + return types.Coin{} } type QueryTotalSwappableAmountRequest struct { @@ -147,7 +155,7 @@ func (m *QueryTotalSwappableAmountRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryTotalSwappableAmountRequest proto.InternalMessageInfo type QueryTotalSwappableAmountResponse struct { - SwappableNewCoinAmount types.Coin `protobuf:"bytes,1,opt,name=swappable_new_coin_amount,json=swappableNewCoinAmount,proto3,castrepeated=github.com/Finschia/finschia-sdk/types.Coin" json:"swappable_new_coin_amount"` + SwappableNewCoin types.Coin `protobuf:"bytes,1,opt,name=swappable_new_coin,json=swappableNewCoin,proto3,castrepeated=github.com/Finschia/finschia-sdk/types.Coin" json:"swappable_new_coin"` } func (m *QueryTotalSwappableAmountResponse) Reset() { *m = QueryTotalSwappableAmountResponse{} } @@ -183,9 +191,9 @@ func (m *QueryTotalSwappableAmountResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryTotalSwappableAmountResponse proto.InternalMessageInfo -func (m *QueryTotalSwappableAmountResponse) GetSwappableNewCoinAmount() types.Coin { +func (m *QueryTotalSwappableAmountResponse) GetSwappableNewCoin() types.Coin { if m != nil { - return m.SwappableNewCoinAmount + return m.SwappableNewCoin } return types.Coin{} } @@ -200,35 +208,36 @@ func init() { func init() { proto.RegisterFile("lbm/fswap/v1/query.proto", fileDescriptor_01deae9da7816d6a) } var fileDescriptor_01deae9da7816d6a = []byte{ - // 441 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0x41, 0x8b, 0xd3, 0x40, - 0x14, 0xc7, 0x33, 0x8b, 0xba, 0x30, 0x7a, 0x1a, 0xb7, 0xba, 0x0d, 0x9a, 0xdd, 0xcd, 0x45, 0x45, - 0x9c, 0x21, 0xbb, 0xf8, 0x01, 0xac, 0x20, 0x1e, 0x54, 0xb0, 0x7a, 0xf2, 0x52, 0x26, 0xd9, 0xd9, - 0xec, 0x60, 0x32, 0x2f, 0xcd, 0x4c, 0x1a, 0x7b, 0xf5, 0xe6, 0x4d, 0xf0, 0x4b, 0x88, 0x20, 0x7e, - 0x8d, 0x1e, 0x0b, 0x5e, 0x3c, 0xa9, 0xb4, 0x7e, 0x10, 0xc9, 0x64, 0x2a, 0x06, 0x42, 0xf5, 0xf6, - 0x78, 0xef, 0x9f, 0xf9, 0xff, 0xde, 0xff, 0x05, 0xef, 0x67, 0x71, 0xce, 0xce, 0x74, 0xcd, 0x0b, - 0x36, 0x8b, 0xd8, 0xb4, 0x12, 0xe5, 0x9c, 0x16, 0x25, 0x18, 0x20, 0x57, 0xb2, 0x38, 0xa7, 0x76, - 0x42, 0x67, 0x91, 0x7f, 0x23, 0x05, 0x48, 0x33, 0xc1, 0x78, 0x21, 0x19, 0x57, 0x0a, 0x0c, 0x37, - 0x12, 0x94, 0x6e, 0xb5, 0xfe, 0x5e, 0x0a, 0x29, 0xd8, 0x92, 0x35, 0x95, 0xeb, 0x06, 0x09, 0xe8, - 0x1c, 0x34, 0x8b, 0xb9, 0x16, 0x6c, 0x16, 0xc5, 0xc2, 0xf0, 0x88, 0x25, 0x20, 0x95, 0x9b, 0x77, - 0xbd, 0x5b, 0x2b, 0x3b, 0x09, 0x07, 0xf8, 0xea, 0xf3, 0x06, 0xe5, 0x45, 0xcd, 0x8b, 0x42, 0x9c, - 0x8e, 0xc5, 0xb4, 0x12, 0xda, 0x84, 0x4f, 0xf1, 0x5e, 0xb7, 0xad, 0x0b, 0x50, 0x5a, 0x90, 0xfb, - 0x78, 0x57, 0xb7, 0xad, 0x7d, 0x74, 0x88, 0x6e, 0x5f, 0x3e, 0x1e, 0xd0, 0xbf, 0xe1, 0xa9, 0xd3, - 0x8f, 0x2e, 0x2c, 0xbe, 0x1f, 0x78, 0xe3, 0x8d, 0x36, 0x0c, 0xf1, 0xa1, 0x7d, 0xee, 0x25, 0x18, - 0x9e, 0x59, 0x0d, 0x8f, 0x33, 0xf1, 0x20, 0x87, 0x4a, 0x99, 0x8d, 0xe5, 0x17, 0x84, 0x8f, 0xb6, - 0x88, 0x1c, 0xc0, 0x3b, 0x84, 0x87, 0x7a, 0x33, 0x9b, 0x28, 0x51, 0x4f, 0x9a, 0x35, 0x27, 0xdc, - 0xaa, 0x1c, 0xd3, 0x90, 0xb6, 0x71, 0xd0, 0x26, 0x0e, 0xea, 0xe2, 0xa0, 0x0f, 0x41, 0xaa, 0xd1, - 0x49, 0xc3, 0xf5, 0xe9, 0xc7, 0xc1, 0xdd, 0x54, 0x9a, 0xf3, 0x2a, 0xa6, 0x09, 0xe4, 0xec, 0x91, - 0x54, 0x3a, 0x39, 0x97, 0x9c, 0x9d, 0xb9, 0xe2, 0x9e, 0x3e, 0x7d, 0xcd, 0xcc, 0xbc, 0x10, 0xda, - 0x7e, 0x34, 0xbe, 0xf6, 0xc7, 0xf0, 0x99, 0xa8, 0x9b, 0x4e, 0xcb, 0x74, 0xfc, 0x71, 0x07, 0x5f, - 0xb4, 0xc4, 0x04, 0xf0, 0xae, 0xdb, 0x9c, 0x1c, 0x75, 0x03, 0xe9, 0x09, 0xd7, 0x0f, 0xb7, 0x49, - 0xda, 0x3d, 0xc3, 0x9b, 0x6f, 0xbf, 0xfe, 0xfa, 0xb0, 0x73, 0x9d, 0x0c, 0x58, 0xe7, 0x74, 0x2e, - 0x50, 0xf2, 0x19, 0xe1, 0xa1, 0xcd, 0xa9, 0x21, 0xaa, 0xca, 0x52, 0xa8, 0xc4, 0x3e, 0xf1, 0x44, - 0xe6, 0xd2, 0x10, 0xda, 0x63, 0xb0, 0x25, 0x7a, 0x9f, 0xfd, 0xb7, 0xde, 0xd1, 0x31, 0x4b, 0x77, - 0x87, 0xdc, 0xea, 0xa1, 0xeb, 0x3b, 0xcc, 0xe8, 0xf1, 0x62, 0x15, 0xa0, 0xe5, 0x2a, 0x40, 0x3f, - 0x57, 0x01, 0x7a, 0xbf, 0x0e, 0xbc, 0xe5, 0x3a, 0xf0, 0xbe, 0xad, 0x03, 0xef, 0x15, 0xfd, 0xe7, - 0x25, 0xde, 0x38, 0x03, 0x7b, 0x91, 0xf8, 0x92, 0xfd, 0x6f, 0x4f, 0x7e, 0x07, 0x00, 0x00, 0xff, - 0xff, 0xb5, 0xb0, 0x8d, 0x67, 0x4f, 0x03, 0x00, 0x00, + // 449 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x93, 0xc1, 0x6a, 0xd4, 0x40, + 0x18, 0xc7, 0x33, 0x0b, 0x5a, 0x19, 0x3d, 0xc8, 0xd8, 0x62, 0x1b, 0x34, 0x6d, 0x73, 0x51, 0x11, + 0x67, 0x48, 0xfb, 0x04, 0x56, 0x10, 0x0f, 0x22, 0x58, 0x3d, 0x79, 0x59, 0x26, 0xc9, 0x34, 0x1d, + 0x4c, 0xe6, 0x4b, 0x33, 0x93, 0x8d, 0x05, 0x4f, 0x3e, 0x81, 0xe0, 0x13, 0x78, 0x13, 0xc1, 0xf7, + 0xe8, 0xb1, 0xe0, 0xc5, 0x93, 0xca, 0xae, 0x47, 0x1f, 0x42, 0x66, 0x32, 0x5d, 0x0c, 0x2c, 0xab, + 0x97, 0xbd, 0x7d, 0xe4, 0xfb, 0x66, 0x7e, 0xff, 0xef, 0xff, 0x9f, 0xe0, 0xcd, 0x32, 0xad, 0xd8, + 0x91, 0xee, 0x78, 0xcd, 0x26, 0x09, 0x3b, 0x69, 0x45, 0x73, 0x4a, 0xeb, 0x06, 0x0c, 0x90, 0x6b, + 0x65, 0x5a, 0x51, 0xd7, 0xa1, 0x93, 0x24, 0xbc, 0x55, 0x00, 0x14, 0xa5, 0x60, 0xbc, 0x96, 0x8c, + 0x2b, 0x05, 0x86, 0x1b, 0x09, 0x4a, 0xf7, 0xb3, 0xe1, 0x7a, 0x01, 0x05, 0xb8, 0x92, 0xd9, 0xca, + 0x7f, 0x8d, 0x32, 0xd0, 0x15, 0x68, 0x96, 0x72, 0x2d, 0xd8, 0x24, 0x49, 0x85, 0xe1, 0x09, 0xcb, + 0x40, 0x2a, 0xdf, 0x1f, 0xb2, 0x7b, 0x94, 0xeb, 0xc4, 0x1b, 0xf8, 0xc6, 0x73, 0x2b, 0xe5, 0x45, + 0xc7, 0xeb, 0x5a, 0xe4, 0x87, 0xe2, 0xa4, 0x15, 0xda, 0xc4, 0xbf, 0x11, 0x5e, 0x1f, 0x7e, 0xd7, + 0x35, 0x28, 0x2d, 0x88, 0xc4, 0x57, 0xa0, 0xcc, 0xc7, 0xf6, 0xee, 0x4d, 0xb4, 0x83, 0xee, 0x5e, + 0xdd, 0xdb, 0xa2, 0x3d, 0x9c, 0x5a, 0x38, 0xf5, 0x70, 0xfa, 0x08, 0xa4, 0x3a, 0xd8, 0x3f, 0xfb, + 0xbe, 0x1d, 0x7c, 0xfe, 0xb1, 0x7d, 0xbf, 0x90, 0xe6, 0xb8, 0x4d, 0x69, 0x06, 0x15, 0x7b, 0x2c, + 0x95, 0xce, 0x8e, 0x25, 0x67, 0x47, 0xbe, 0x78, 0xa0, 0xf3, 0xd7, 0xcc, 0x9c, 0xd6, 0x42, 0xbb, + 0x43, 0x87, 0x6b, 0x50, 0xe6, 0xb6, 0xb0, 0x28, 0x25, 0xba, 0x1e, 0x35, 0x5a, 0x0d, 0x4a, 0x89, + 0xce, 0x16, 0x71, 0x8c, 0x77, 0xdc, 0xb6, 0x2f, 0xc1, 0xf0, 0xd2, 0xad, 0xcc, 0xd3, 0x52, 0x3c, + 0xac, 0xa0, 0x55, 0xe6, 0xc2, 0x92, 0x8f, 0x08, 0xef, 0x2e, 0x19, 0xf2, 0xfe, 0xbc, 0xc5, 0x44, + 0x5f, 0xb4, 0xc6, 0x73, 0xf9, 0xab, 0x71, 0xea, 0xfa, 0x9c, 0xf4, 0xac, 0xdf, 0x63, 0xef, 0xd3, + 0x08, 0x5f, 0x72, 0x1a, 0x09, 0xe0, 0x35, 0x1f, 0x1d, 0xd9, 0xa5, 0x7f, 0xbf, 0x2f, 0xba, 0x20, + 0xee, 0x30, 0x5e, 0x36, 0xd2, 0x6f, 0x16, 0xdf, 0x7e, 0xf7, 0xf5, 0xd7, 0x87, 0xd1, 0x4d, 0xb2, + 0xc1, 0x06, 0x8f, 0x49, 0x7b, 0xca, 0x17, 0x84, 0xb7, 0x9c, 0x33, 0x56, 0x4b, 0xdb, 0x34, 0x42, + 0x65, 0xee, 0x8a, 0xa7, 0xb2, 0x92, 0x86, 0xd0, 0x05, 0x80, 0x25, 0x66, 0x87, 0xec, 0xbf, 0xe7, + 0xbd, 0x3a, 0xe6, 0xd4, 0xdd, 0x23, 0x77, 0x16, 0xa8, 0x1b, 0x64, 0x31, 0xe6, 0xee, 0xe0, 0xc1, + 0x93, 0xb3, 0x69, 0x84, 0xce, 0xa7, 0x11, 0xfa, 0x39, 0x8d, 0xd0, 0xfb, 0x59, 0x14, 0x9c, 0xcf, + 0xa2, 0xe0, 0xdb, 0x2c, 0x0a, 0x5e, 0xd1, 0x7f, 0x66, 0xf0, 0xc6, 0x03, 0x5c, 0x16, 0xe9, 0x65, + 0xf7, 0x27, 0xed, 0xff, 0x09, 0x00, 0x00, 0xff, 0xff, 0x91, 0x66, 0x98, 0xa4, 0xe1, 0x03, 0x00, + 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -391,7 +400,17 @@ func (m *QuerySwappedResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { var l int _ = l { - size, err := m.Swapped.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.NewCoin.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.OldCoin.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -447,7 +466,7 @@ func (m *QueryTotalSwappableAmountResponse) MarshalToSizedBuffer(dAtA []byte) (i var l int _ = l { - size, err := m.SwappableNewCoinAmount.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.SwappableNewCoin.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -485,7 +504,9 @@ func (m *QuerySwappedResponse) Size() (n int) { } var l int _ = l - l = m.Swapped.Size() + l = m.OldCoin.Size() + n += 1 + l + sovQuery(uint64(l)) + l = m.NewCoin.Size() n += 1 + l + sovQuery(uint64(l)) return n } @@ -505,7 +526,7 @@ func (m *QueryTotalSwappableAmountResponse) Size() (n int) { } var l int _ = l - l = m.SwappableNewCoinAmount.Size() + l = m.SwappableNewCoin.Size() n += 1 + l + sovQuery(uint64(l)) return n } @@ -597,7 +618,40 @@ func (m *QuerySwappedResponse) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Swapped", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field OldCoin", 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.OldCoin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NewCoin", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -624,7 +678,7 @@ func (m *QuerySwappedResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Swapped.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.NewCoin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -730,7 +784,7 @@ func (m *QueryTotalSwappableAmountResponse) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SwappableNewCoinAmount", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field SwappableNewCoin", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -757,7 +811,7 @@ func (m *QueryTotalSwappableAmountResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.SwappableNewCoinAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.SwappableNewCoin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex From 82e8936869df6fe78813685930cf93464e4f3dea Mon Sep 17 00:00:00 2001 From: Jayden Lee <41176085+tkxkd0159@users.noreply.github.com> Date: Mon, 29 Apr 2024 13:37:56 +0900 Subject: [PATCH 3/7] 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 --- CHANGELOG.md | 1 + client/docs/config.json | 14 + client/docs/swagger-ui/swagger.yaml | 1195 +++++++ docs/core/proto-docs.md | 1168 ++++++ 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 | 185 + proto/lbm/fbridge/v1/tx.proto | 169 + x/fbridge/client/cli/query.go | 18 + x/fbridge/client/cli/tx.go | 23 + x/fbridge/keeper/genesis.go | 14 + x/fbridge/keeper/grpc_query.go | 61 + x/fbridge/keeper/keeper.go | 3 + x/fbridge/keeper/msg_server.go | 61 + x/fbridge/module/module.go | 164 + x/fbridge/types/codec.go | 63 + x/fbridge/types/event.pb.go | 1292 +++++++ x/fbridge/types/expected_keepers.go | 1 + x/fbridge/types/fbridge.pb.go | 1650 +++++++++ x/fbridge/types/genesis.go | 9 + x/fbridge/types/genesis.pb.go | 2347 ++++++++++++ x/fbridge/types/keys.go | 9 + x/fbridge/types/msgs.go | 127 + x/fbridge/types/query.pb.go | 5094 +++++++++++++++++++++++++++ x/fbridge/types/query.pb.gw.go | 1166 ++++++ x/fbridge/types/tx.pb.go | 4495 +++++++++++++++++++++++ 27 files changed, 19529 insertions(+) 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 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/module/module.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/query.pb.go create mode 100644 x/fbridge/types/query.pb.gw.go create mode 100644 x/fbridge/types/tx.pb.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d2bc136b5..b1613e11c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (consensus) [\#1178](https://github.com/Finschia/finschia-sdk/pull/1178) change the consensus from Ostracon to Tendermint v0.34.24 * (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) [\#1336](https://github.com/Finschia/finschia-sdk/pull/1340) Initialize fbridge module ### Improvements * (docs) [\#1120](https://github.com/Finschia/finschia-sdk/pull/1120) Update links in x/foundation README.md diff --git a/client/docs/config.json b/client/docs/config.json index 1bf69f7c03..4a1968c6ee 100644 --- a/client/docs/config.json +++ b/client/docs/config.json @@ -164,6 +164,20 @@ }, { "url": "./tmp-swagger-gen/cosmos/base/node/v1beta1/query.swagger.json" + }, + { + "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/client/docs/swagger-ui/swagger.yaml b/client/docs/swagger-ui/swagger.yaml index 0a671c6747..c56e21d150 100644 --- a/client/docs/swagger-ui/swagger.yaml +++ b/client/docs/swagger-ui/swagger.yaml @@ -29799,6 +29799,813 @@ paths: format: byte tags: - Service + '/lbm/fbridge/v1/commitments/{seq}': + get: + summary: Commitments queries commitments of a specific sequence number + operationId: FBridgeCommitments + responses: + '200': + description: A successful response. + schema: + type: object + properties: + commitments: + type: array + items: + type: string + default: + description: An unexpected error response + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + parameters: + - name: seq + description: the sequence number of the bridge request + in: path + required: true + type: string + format: uint64 + tags: + - Query + /lbm/fbridge/v1/greatest_confirmed_seq: + get: + summary: >- + GreatestConsecutiveConfirmedSeq queries a greatest consecutive sequence + number confirmed by n-of-m operators + operationId: GreatestConsecutiveConfirmedSeq + responses: + '200': + description: A successful response. + schema: + type: object + properties: + seq: + type: string + format: uint64 + default: + description: An unexpected error response + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + tags: + - Query + /lbm/fbridge/v1/guardians: + get: + summary: Guardians queries a list of Guardians registered on the bridge + operationId: FBridgeGuardians + responses: + '200': + description: A successful response. + schema: + type: object + properties: + guardians: + type: array + items: + type: string + default: + description: An unexpected error response + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + tags: + - Query + /lbm/fbridge/v1/judges: + get: + summary: Judges queries a list of Judges registered on the bridge + operationId: FBridgeJudges + responses: + '200': + description: A successful response. + schema: + type: object + properties: + judges: + type: array + items: + type: string + default: + description: An unexpected error response + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + tags: + - Query + /lbm/fbridge/v1/nextseq_send: + get: + summary: NextSeqSend queries the sequence of next bridge request + operationId: NextSeqSend + responses: + '200': + description: A successful response. + schema: + type: object + properties: + seq: + type: string + format: uint64 + default: + description: An unexpected error response + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + tags: + - Query + /lbm/fbridge/v1/operators: + get: + summary: Operators queries a list of Operators registered on the bridge + operationId: FBridgeOperators + responses: + '200': + description: A successful response. + schema: + type: object + properties: + operators: + type: array + items: + type: string + default: + description: An unexpected error response + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + tags: + - Query + '/lbm/fbridge/v1/operators/{operator}/needed_submission_seqs': + get: + summary: >- + 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 + operationId: NeededSubmissionSeqs + responses: + '200': + description: A successful response. + schema: + type: object + properties: + seqs: + type: array + items: + type: string + format: uint64 + default: + description: An unexpected error response + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + parameters: + - name: operator + description: the address of the operator + in: path + required: true + type: string + - name: range + description: range specifies the size of the range to search. + in: query + required: false + type: string + format: uint64 + tags: + - Query + '/lbm/fbridge/v1/operators/{operator}/provision/{seq}': + get: + summary: >- + SubmittedProvision queries a provision submitted by a particular + operator + operationId: SubmittedProvision + responses: + '200': + description: A successful response. + schema: + type: object + properties: + data: + type: object + properties: + seq: + type: string + format: uint64 + title: the sequence number of the bridge request + amount: + type: string + title: the amount of token to be claimed + sender: + type: string + title: the sender address on the source chain + receiver: + type: string + title: the recipient address on the destination chain + description: Provision is a struct that represents a provision internally. + status: + type: object + properties: + timelock_end: + type: string + format: uint64 + title: >- + the unix timestamp the provision will be able to be + claimed (unix timestamp) + confirm_counts: + type: integer + format: int32 + title: >- + a value that tells how many operators have submitted this + provision + is_claimed: + type: boolean + format: boolean + title: whether the provision has been claimed + description: >- + ProvisionStatus is a struct that represents the status of a + provision. + + To optimize computational cost, we have collected frequently + changing values from provision. + default: + description: An unexpected error response + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + parameters: + - name: operator + description: the address of the operator + in: path + required: true + type: string + - name: seq + description: the sequence number of the bridge request + in: path + required: true + type: string + format: uint64 + tags: + - Query + '/lbm/fbridge/v1/operators/{operator}/seq': + get: + summary: >- + GreatestSeqByOperator queries a greatest sequence number confirmed by a + particular operator + operationId: GreatestSeqByOperator + responses: + '200': + description: A successful response. + schema: + type: object + properties: + seq: + type: string + format: uint64 + default: + description: An unexpected error response + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + parameters: + - name: operator + description: the address of the operator + in: path + required: true + type: string + tags: + - Query + /lbm/fbridge/v1/params: + get: + summary: Params queries the parameters of x/fbridge module. + operationId: FBridgeParams + responses: + '200': + description: A successful response. + schema: + type: object + properties: + params: + type: object + properties: + operator_trust_level: + description: >- + ratio of how many operators' confirmations are needed to + be valid. + type: object + properties: + numerator: + type: string + format: uint64 + denominator: + type: string + format: uint64 + guardian_trust_level: + description: >- + ratio of how many guardians' confirmations are needed to + be valid. + type: object + properties: + numerator: + type: string + format: uint64 + denominator: + type: string + format: uint64 + judge_trust_level: + description: >- + ratio of how many judges' confirmations are needed to be + valid. + type: object + properties: + numerator: + type: string + format: uint64 + denominator: + type: string + format: uint64 + timelock_period: + type: string + format: uint64 + title: >- + default timelock period for each provision (unix + timestamp) + proposal_period: + type: string + format: uint64 + title: default period of the proposal to update the role + default: + description: An unexpected error response + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + tags: + - Query + '/lbm/fbridge/v1/provision/{seq}': + get: + summary: ConfirmedProvision queries a particular sequence of confirmed provisions + operationId: ConfirmedProvision + responses: + '200': + description: A successful response. + schema: + type: object + properties: + data: + type: object + properties: + seq: + type: string + format: uint64 + title: the sequence number of the bridge request + amount: + type: string + title: the amount of token to be claimed + sender: + type: string + title: the sender address on the source chain + receiver: + type: string + title: the recipient address on the destination chain + description: Provision is a struct that represents a provision internally. + status: + type: object + properties: + timelock_end: + type: string + format: uint64 + title: >- + the unix timestamp the provision will be able to be + claimed (unix timestamp) + confirm_counts: + type: integer + format: int32 + title: >- + a value that tells how many operators have submitted this + provision + is_claimed: + type: boolean + format: boolean + title: whether the provision has been claimed + description: >- + ProvisionStatus is a struct that represents the status of a + provision. + + To optimize computational cost, we have collected frequently + changing values from provision. + default: + description: An unexpected error response + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + parameters: + - name: seq + description: the sequence number of the bridge request + in: path + required: true + type: string + format: uint64 + tags: + - Query + /lbm/fbridge/v1/role/proposals: + get: + summary: Proposals queries a list of SuggestRole Proposals + operationId: FBridgeProposals + responses: + '200': + description: A successful response. + schema: + type: object + properties: + proposals: + type: array + items: + type: object + properties: + id: + type: string + format: uint64 + proposer: + type: string + title: the proposer address + target: + type: string + title: the address to update the role + role: + title: >- + the role to be updated + + - unspecified : 0, used to remove the address from a + group + + - guardian : 1 + + - operator : 2 + + - judge : 3 + type: string + enum: + - UNSPECIFIED + - GUARDIAN + - OPERATOR + - JUDGE + default: UNSPECIFIED + description: >- + Role defines the role of the operator, guardian, and + judge. + expired_at: + type: string + format: uint64 + title: >- + the unix timestamp the proposal will be expired (unix + timestamp) + default: + description: An unexpected error response + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + parameters: + - name: pagination.key + description: |- + key is a value returned in PageResponse.next_key to begin + querying the next page most efficiently. Only one of offset or key + should be set. + in: query + required: false + type: string + format: byte + - name: pagination.offset + description: >- + offset is a numeric offset that can be used when key is unavailable. + + It is less efficient than using key. Only one of offset or key + should + + be set. + in: query + required: false + type: string + format: uint64 + - name: pagination.limit + description: >- + limit is the total number of results to be returned in the result + page. + + If left empty it will default to a value to be set by each app. + in: query + required: false + type: string + format: uint64 + - name: pagination.count_total + description: >- + count_total is set to true to indicate that the result set should + include + + a count of the total number of items available for pagination in + UIs. + + count_total is only respected when offset is used. It is ignored + when key + + is set. + in: query + required: false + type: boolean + format: boolean + - name: pagination.reverse + description: >- + reverse is set to true if results are to be returned in the + descending order. + + + Since: cosmos-sdk 0.43 + in: query + required: false + type: boolean + format: boolean + tags: + - Query + '/lbm/fbridge/v1/role/proposals/{proposal_id}': + get: + summary: Proposal queries a SuggestRole Proposal + operationId: FBridgeProposal + responses: + '200': + description: A successful response. + schema: + type: object + properties: + proposal: + type: object + properties: + id: + type: string + format: uint64 + proposer: + type: string + title: the proposer address + target: + type: string + title: the address to update the role + role: + title: |- + the role to be updated + - unspecified : 0, used to remove the address from a group + - guardian : 1 + - operator : 2 + - judge : 3 + type: string + enum: + - UNSPECIFIED + - GUARDIAN + - OPERATOR + - JUDGE + default: UNSPECIFIED + description: >- + Role defines the role of the operator, guardian, and + judge. + expired_at: + type: string + format: uint64 + title: >- + the unix timestamp the proposal will be expired (unix + timestamp) + default: + description: An unexpected error response + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + parameters: + - name: proposal_id + description: the proposal id + in: path + required: true + type: string + tags: + - Query definitions: cosmos.auth.v1beta1.Params: type: object @@ -49344,3 +50151,391 @@ definitions: minimum_gas_price: type: string description: ConfigResponse defines the response structure for the Config gRPC query. + lbm.fbridge.v1.Fraction: + type: object + properties: + numerator: + type: string + format: uint64 + denominator: + type: string + format: uint64 + description: |- + Fraction defines the protobuf message type for tmmath.Fraction that only + supports positive values. + lbm.fbridge.v1.Params: + type: object + properties: + operator_trust_level: + description: ratio of how many operators' confirmations are needed to be valid. + type: object + properties: + numerator: + type: string + format: uint64 + denominator: + type: string + format: uint64 + guardian_trust_level: + description: ratio of how many guardians' confirmations are needed to be valid. + type: object + properties: + numerator: + type: string + format: uint64 + denominator: + type: string + format: uint64 + judge_trust_level: + description: ratio of how many judges' confirmations are needed to be valid. + type: object + properties: + numerator: + type: string + format: uint64 + denominator: + type: string + format: uint64 + timelock_period: + type: string + format: uint64 + title: default timelock period for each provision (unix timestamp) + proposal_period: + type: string + format: uint64 + title: default period of the proposal to update the role + lbm.fbridge.v1.ProvisionData: + type: object + properties: + seq: + type: string + format: uint64 + title: the sequence number of the bridge request + amount: + type: string + title: the amount of token to be claimed + sender: + type: string + title: the sender address on the source chain + receiver: + type: string + title: the recipient address on the destination chain + description: Provision is a struct that represents a provision internally. + lbm.fbridge.v1.ProvisionStatus: + type: object + properties: + timelock_end: + type: string + format: uint64 + title: >- + the unix timestamp the provision will be able to be claimed (unix + timestamp) + confirm_counts: + type: integer + format: int32 + title: a value that tells how many operators have submitted this provision + is_claimed: + type: boolean + format: boolean + title: whether the provision has been claimed + description: >- + ProvisionStatus is a struct that represents the status of a provision. + + To optimize computational cost, we have collected frequently changing + values from provision. + lbm.fbridge.v1.QueryCommitmentsResponse: + type: object + properties: + commitments: + type: array + items: + type: string + lbm.fbridge.v1.QueryConfirmedProvisionResponse: + type: object + properties: + data: + type: object + properties: + seq: + type: string + format: uint64 + title: the sequence number of the bridge request + amount: + type: string + title: the amount of token to be claimed + sender: + type: string + title: the sender address on the source chain + receiver: + type: string + title: the recipient address on the destination chain + description: Provision is a struct that represents a provision internally. + status: + type: object + properties: + timelock_end: + type: string + format: uint64 + title: >- + the unix timestamp the provision will be able to be claimed (unix + timestamp) + confirm_counts: + type: integer + format: int32 + title: >- + a value that tells how many operators have submitted this + provision + is_claimed: + type: boolean + format: boolean + title: whether the provision has been claimed + description: >- + ProvisionStatus is a struct that represents the status of a provision. + + To optimize computational cost, we have collected frequently changing + values from provision. + lbm.fbridge.v1.QueryGreatestConsecutiveConfirmedSeqResponse: + type: object + properties: + seq: + type: string + format: uint64 + lbm.fbridge.v1.QueryGreatestSeqByOperatorResponse: + type: object + properties: + seq: + type: string + format: uint64 + lbm.fbridge.v1.QueryGuardiansResponse: + type: object + properties: + guardians: + type: array + items: + type: string + lbm.fbridge.v1.QueryJudgesResponse: + type: object + properties: + judges: + type: array + items: + type: string + lbm.fbridge.v1.QueryNeededSubmissionSeqsResponse: + type: object + properties: + seqs: + type: array + items: + type: string + format: uint64 + lbm.fbridge.v1.QueryNextSeqSendResponse: + type: object + properties: + seq: + type: string + format: uint64 + lbm.fbridge.v1.QueryOperatorsResponse: + type: object + properties: + operators: + type: array + items: + type: string + lbm.fbridge.v1.QueryParamsResponse: + type: object + properties: + params: + type: object + properties: + operator_trust_level: + description: ratio of how many operators' confirmations are needed to be valid. + type: object + properties: + numerator: + type: string + format: uint64 + denominator: + type: string + format: uint64 + guardian_trust_level: + description: ratio of how many guardians' confirmations are needed to be valid. + type: object + properties: + numerator: + type: string + format: uint64 + denominator: + type: string + format: uint64 + judge_trust_level: + description: ratio of how many judges' confirmations are needed to be valid. + type: object + properties: + numerator: + type: string + format: uint64 + denominator: + type: string + format: uint64 + timelock_period: + type: string + format: uint64 + title: default timelock period for each provision (unix timestamp) + proposal_period: + type: string + format: uint64 + title: default period of the proposal to update the role + lbm.fbridge.v1.QueryProposalResponse: + type: object + properties: + proposal: + type: object + properties: + id: + type: string + format: uint64 + proposer: + type: string + title: the proposer address + target: + type: string + title: the address to update the role + role: + title: |- + the role to be updated + - unspecified : 0, used to remove the address from a group + - guardian : 1 + - operator : 2 + - judge : 3 + type: string + enum: + - UNSPECIFIED + - GUARDIAN + - OPERATOR + - JUDGE + default: UNSPECIFIED + description: 'Role defines the role of the operator, guardian, and judge.' + expired_at: + type: string + format: uint64 + title: the unix timestamp the proposal will be expired (unix timestamp) + lbm.fbridge.v1.QueryProposalsResponse: + type: object + properties: + proposals: + type: array + items: + type: object + properties: + id: + type: string + format: uint64 + proposer: + type: string + title: the proposer address + target: + type: string + title: the address to update the role + role: + title: |- + the role to be updated + - unspecified : 0, used to remove the address from a group + - guardian : 1 + - operator : 2 + - judge : 3 + type: string + enum: + - UNSPECIFIED + - GUARDIAN + - OPERATOR + - JUDGE + default: UNSPECIFIED + description: 'Role defines the role of the operator, guardian, and judge.' + expired_at: + type: string + format: uint64 + title: the unix timestamp the proposal will be expired (unix timestamp) + lbm.fbridge.v1.QuerySubmittedProvisionResponse: + type: object + properties: + data: + type: object + properties: + seq: + type: string + format: uint64 + title: the sequence number of the bridge request + amount: + type: string + title: the amount of token to be claimed + sender: + type: string + title: the sender address on the source chain + receiver: + type: string + title: the recipient address on the destination chain + description: Provision is a struct that represents a provision internally. + status: + type: object + properties: + timelock_end: + type: string + format: uint64 + title: >- + the unix timestamp the provision will be able to be claimed (unix + timestamp) + confirm_counts: + type: integer + format: int32 + title: >- + a value that tells how many operators have submitted this + provision + is_claimed: + type: boolean + format: boolean + title: whether the provision has been claimed + description: >- + ProvisionStatus is a struct that represents the status of a provision. + + To optimize computational cost, we have collected frequently changing + values from provision. + lbm.fbridge.v1.Role: + type: string + enum: + - UNSPECIFIED + - GUARDIAN + - OPERATOR + - JUDGE + default: UNSPECIFIED + description: 'Role defines the role of the operator, guardian, and judge.' + lbm.fbridge.v1.RoleProposal: + type: object + properties: + id: + type: string + format: uint64 + proposer: + type: string + title: the proposer address + target: + type: string + title: the address to update the role + role: + title: |- + the role to be updated + - unspecified : 0, used to remove the address from a group + - guardian : 1 + - operator : 2 + - judge : 3 + type: string + enum: + - UNSPECIFIED + - GUARDIAN + - OPERATOR + - JUDGE + default: UNSPECIFIED + description: 'Role defines the role of the operator, guardian, and judge.' + expired_at: + type: string + format: uint64 + title: the unix timestamp the proposal will be expired (unix timestamp) diff --git a/docs/core/proto-docs.md b/docs/core/proto-docs.md index 7d6e8b010d..8982d795db 100644 --- a/docs/core/proto-docs.md +++ b/docs/core/proto-docs.md @@ -754,6 +754,87 @@ - [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) + - [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) @@ -11300,6 +11381,1093 @@ Msg defines the collection Msg service. + +

Top

+ +## lbm/fbridge/v1/event.proto + + + + + +### EventClaim + + + +| 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 + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `seq` | [uint64](#uint64) | | the sequence number of the bridge request | + + + + + + + + +### EventProvision + + + +| 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 | +| `operator` | [string](#string) | | the address of the operator | + + + + + + + + +### EventTransfer + + + +| 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 transferred | + + + + + + + + + + + + + + + + +

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 | +| ----- | ---- | ----- | ----------- | +| `numerator` | [uint64](#uint64) | | | +| `denominator` | [uint64](#uint64) | | | + + + + + + + + +### Params + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `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 | + + + + + + + + +### ProvisionData +Provision is a struct that represents a provision internally. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `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 | + + + + + + + + +### 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 | +| ----- | ---- | ----- | ----------- | +| `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 + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `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) | + + + + + + + + + + +### Role +Role defines the role of the operator, guardian, and judge. + +| Name | Number | Description | +| ---- | ------ | ----------- | +| UNSPECIFIED | 0 | | +| GUARDIAN | 1 | | +| OPERATOR | 2 | | +| JUDGE | 3 | | + + + + + + + + + + + +

Top

+ +## lbm/fbridge/v1/genesis.proto + + + + + +### BlockSeqInfo + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `seq` | [uint64](#uint64) | | | +| `blocknum` | [uint64](#uint64) | | | + + + + + + + + +### Commitment + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `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 + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `seq` | [uint64](#uint64) | | the sequence number of the bridge request | +| `commitment` | [string](#string) | | commitment is the hash value of a provision | + + + + + + + + +### GenesisState +GenesisState defines the fbridge module's genesis state. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `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 + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `operator` | [string](#string) | | the operator address | +| `seq` | [uint64](#uint64) | | the sequence number | + + + + + + + + +### Provision + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `commitment` | [string](#string) | | | +| `data` | [ProvisionData](#lbm.fbridge.v1.ProvisionData) | | | +| `status` | [ProvisionStatus](#lbm.fbridge.v1.ProvisionStatus) | | | + + + + + + + + +### ReceivingState + + + +| 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 | + + + + + + + + +### SendingState + + + +| 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 | + + + + + + + + + + + + + + + + +

Top

+ +## lbm/fbridge/v1/query.proto + + + + + +### QueryCommitmentsRequest + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `seq` | [uint64](#uint64) | | the sequence number of the bridge request | + + + + + + + + +### QueryCommitmentsResponse + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `commitments` | [string](#string) | repeated | | + + + + + + + + +### QueryConfirmedProvisionRequest + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `seq` | [uint64](#uint64) | | the sequence number of the bridge request | + + + + + + + + +### QueryConfirmedProvisionResponse + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `data` | [ProvisionData](#lbm.fbridge.v1.ProvisionData) | | | +| `status` | [ProvisionStatus](#lbm.fbridge.v1.ProvisionStatus) | | | + + + + + + + + +### QueryGreatestConsecutiveConfirmedSeqRequest + + + + + + + + + +### QueryGreatestConsecutiveConfirmedSeqResponse + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `seq` | [uint64](#uint64) | | | + + + + + + + + +### QueryGreatestSeqByOperatorRequest + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `operator` | [string](#string) | | the address of the operator | + + + + + + + + +### QueryGreatestSeqByOperatorResponse + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `seq` | [uint64](#uint64) | | | + + + + + + + + +### QueryGuardiansRequest + + + + + + + + + +### QueryGuardiansResponse + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `guardians` | [string](#string) | repeated | | + + + + + + + + +### QueryJudgesRequest + + + + + + + + + +### QueryJudgesResponse + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `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 | + + + + + + + + +### QueryNeededSubmissionSeqsResponse + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `seqs` | [uint64](#uint64) | repeated | | + + + + + + + + +### QueryNextSeqSendRequest + + + + + + + + + +### QueryNextSeqSendResponse + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `seq` | [uint64](#uint64) | | | + + + + + + + + +### QueryOperatorsRequest + + + + + + + + + +### QueryOperatorsResponse + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `operators` | [string](#string) | repeated | | + + + + + + + + +### QueryParamsRequest + + + + + + + + + +### QueryParamsResponse + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `params` | [Params](#lbm.fbridge.v1.Params) | | | + + + + + + + + +### QueryProposalRequest + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `proposal_id` | [string](#string) | | the proposal id | + + + + + + + + +### QueryProposalResponse + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `proposal` | [RoleProposal](#lbm.fbridge.v1.RoleProposal) | | | + + + + + + + + +### QueryProposalsRequest + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | pagination defines an optional pagination for the request. | + + + + + + + + +### QueryProposalsResponse + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `proposals` | [RoleProposal](#lbm.fbridge.v1.RoleProposal) | repeated | | + + + + + + + + +### QuerySubmittedProvisionRequest + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `operator` | [string](#string) | | the address of the operator | +| `seq` | [uint64](#uint64) | | the sequence number of the bridge request | + + + + + + + + +### QuerySubmittedProvisionResponse + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `data` | [ProvisionData](#lbm.fbridge.v1.ProvisionData) | | | +| `status` | [ProvisionStatus](#lbm.fbridge.v1.ProvisionStatus) | | | + + + + + + + + + + + + + + +### 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/nextseq_send| +| `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/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/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/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/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/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/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}| + + + + + + +

Top

+ +## lbm/fbridge/v1/tx.proto + + + + + +### MsgAddVoteForRole + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `from` | [string](#string) | | the guardian address | +| `proposal_id` | [uint64](#uint64) | | the proposal ID | +| `option` | [bool](#bool) | | the vote option - yes : true - no : false | + + + + + + + + +### MsgAddVoteForRoleResponse + + + + + + + + + +### MsgClaim +MsgClaim is input values required for claiming a provision + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `from` | [string](#string) | | the claimer address | +| `seq` | [uint64](#uint64) | | the sequence number of the bridge request | + + + + + + + + +### MsgClaimBatch +MsgClaimBatch is input values required for claiming multiple claimable provisions + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `from` | [string](#string) | | the claimer address | +| `max_claims` | [uint64](#uint64) | | the maximum number of claims to be made at once | + + + + + + + + +### MsgClaimBatchResponse + + + + + + + + + +### MsgClaimResponse + + + + + + + + + +### MsgHalt +MsgHalt is input values required for halting the bridge module + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `guardian` | [string](#string) | | the guardian address | + + + + + + + + +### MsgHaltResponse + + + + + + + + + +### MsgHoldTransfer +MsgHoldTransfer is input values required for holding transfer + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `from` | [string](#string) | | the judge address | +| `seq` | [uint64](#uint64) | | the sequence number of the bridge request | + + + + + + + + +### MsgHoldTransferResponse + + + + + + + + + +### 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 | + + + + + + + + +### MsgProvisionResponse + + + + + + + + + +### MsgReleaseTransfer +MsgReleaseTransfer is input values required for releasing a held transfer by time lock + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `from` | [string](#string) | | the guardian address | +| `seq` | [uint64](#uint64) | | the sequence number of the bridge request | + + + + + + + + +### MsgReleaseTransferResponse + + + + + + + + + +### MsgRemoveProvision +MsgRemoveProvision is input values required for removing a specific confirmed provision + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `from` | [string](#string) | | the judge address | +| `seq` | [uint64](#uint64) | | the sequence number of the bridge request | + + + + + + + + +### 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

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..58b1054ef3 --- /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; + // ratio of how many guardians' confirmations are needed to be valid. + Fraction guardian_trust_level = 2; + // ratio of how many judges' confirmations are needed to be valid. + Fraction judge_trust_level = 3; + // 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; +} \ No newline at end of file diff --git a/proto/lbm/fbridge/v1/genesis.proto b/proto/lbm/fbridge/v1/genesis.proto new file mode 100644 index 0000000000..087d1acca9 --- /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; +} + +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..900aac4e8b --- /dev/null +++ b/proto/lbm/fbridge/v1/query.proto @@ -0,0 +1,185 @@ +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/nextseq_send"; + } + + // GreatestSeqByOperator queries a greatest sequence number confirmed by a particular operator + rpc GreatestSeqByOperator(QueryGreatestSeqByOperatorRequest) returns (QueryGreatestSeqByOperatorResponse) { + option (google.api.http).get = "/lbm/fbridge/v1/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/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/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/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/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/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 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; +} \ No newline at end of file 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/x/fbridge/client/cli/query.go b/x/fbridge/client/cli/query.go new file mode 100644 index 0000000000..6ef6d0424a --- /dev/null +++ b/x/fbridge/client/cli/query.go @@ -0,0 +1,18 @@ +package cli + +import ( + "github.com/spf13/cobra" + + "github.com/Finschia/finschia-sdk/x/fbridge/types" +) + +func NewQueryCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: types.ModuleName, + Short: "Querying commands for the fbridge module", + } + + cmd.AddCommand() + + return cmd +} diff --git a/x/fbridge/client/cli/tx.go b/x/fbridge/client/cli/tx.go new file mode 100644 index 0000000000..ef9ef1f04c --- /dev/null +++ b/x/fbridge/client/cli/tx.go @@ -0,0 +1,23 @@ +package cli + +import ( + "github.com/spf13/cobra" + + "github.com/Finschia/finschia-sdk/client" + "github.com/Finschia/finschia-sdk/x/fbridge/types" +) + +// GetTxCmd returns the transaction commands for this module +func NewTxCmd() *cobra.Command { + TxCmd := &cobra.Command{ + Use: types.ModuleName, + Short: "fbridge transactions subcommands", + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + TxCmd.AddCommand() + + return TxCmd +} diff --git a/x/fbridge/keeper/genesis.go b/x/fbridge/keeper/genesis.go new file mode 100644 index 0000000000..42ffc544d4 --- /dev/null +++ b/x/fbridge/keeper/genesis.go @@ -0,0 +1,14 @@ +package keeper + +import ( + 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 { + return nil +} + +func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { + return nil +} diff --git a/x/fbridge/keeper/grpc_query.go b/x/fbridge/keeper/grpc_query.go new file mode 100644 index 0000000000..c157e03e30 --- /dev/null +++ b/x/fbridge/keeper/grpc_query.go @@ -0,0 +1,61 @@ +package keeper + +import ( + "context" + + "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(ctx context.Context, request *types.QueryNextSeqSendRequest) (*types.QueryNextSeqSendResponse, error) { + panic("implement me") +} + +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..d22a739529 --- /dev/null +++ b/x/fbridge/keeper/keeper.go @@ -0,0 +1,3 @@ +package keeper + +type Keeper struct{} diff --git a/x/fbridge/keeper/msg_server.go b/x/fbridge/keeper/msg_server.go new file mode 100644 index 0000000000..58d79ed1b1 --- /dev/null +++ b/x/fbridge/keeper/msg_server.go @@ -0,0 +1,61 @@ +package keeper + +import ( + "context" + + "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(ctx context.Context, transfer *types.MsgTransfer) (*types.MsgTransferResponse, error) { + panic("implement me") +} + +func (m msgServer) Provision(ctx context.Context, provision *types.MsgProvision) (*types.MsgProvisionResponse, error) { + panic("implement me") +} + +func (m msgServer) HoldTransfer(ctx context.Context, transfer *types.MsgHoldTransfer) (*types.MsgHoldTransferResponse, error) { + panic("implement me") +} + +func (m msgServer) ReleaseTransfer(ctx context.Context, transfer *types.MsgReleaseTransfer) (*types.MsgReleaseTransferResponse, error) { + panic("implement me") +} + +func (m msgServer) RemoveProvision(ctx context.Context, provision *types.MsgRemoveProvision) (*types.MsgRemoveProvisionResponse, error) { + panic("implement me") +} + +func (m msgServer) ClaimBatch(ctx context.Context, batch *types.MsgClaimBatch) (*types.MsgClaimBatchResponse, error) { + panic("implement me") +} + +func (m msgServer) Claim(ctx context.Context, claim *types.MsgClaim) (*types.MsgClaimResponse, error) { + panic("implement me") +} + +func (m msgServer) SuggestRole(ctx context.Context, role *types.MsgSuggestRole) (*types.MsgSuggestRoleResponse, error) { + panic("implement me") +} + +func (m msgServer) AddVoteForRole(ctx context.Context, role *types.MsgAddVoteForRole) (*types.MsgAddVoteForRoleResponse, error) { + panic("implement me") +} + +func (m msgServer) Halt(ctx context.Context, halt *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/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/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..ab1254f4c2 --- /dev/null +++ b/x/fbridge/types/expected_keepers.go @@ -0,0 +1 @@ +package types diff --git a/x/fbridge/types/fbridge.pb.go b/x/fbridge/types/fbridge.pb.go new file mode 100644 index 0000000000..9ca2c7a57a --- /dev/null +++ b/x/fbridge/types/fbridge.pb.go @@ -0,0 +1,1650 @@ +// 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,omitempty"` + // 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,omitempty"` + // 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,omitempty"` + // 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 nil +} + +func (m *Params) GetGuardianTrustLevel() *Fraction { + if m != nil { + return m.GuardianTrustLevel + } + return nil +} + +func (m *Params) GetJudgeTrustLevel() *Fraction { + if m != nil { + return m.JudgeTrustLevel + } + return nil +} + +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{ + // 610 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x54, 0x41, 0x4f, 0xdb, 0x30, + 0x14, 0x6e, 0x4a, 0xa9, 0x9a, 0x57, 0x68, 0x3b, 0x0b, 0x4d, 0x08, 0xb1, 0xc2, 0x2a, 0x4d, 0x43, + 0x48, 0x6b, 0x07, 0xbb, 0x4f, 0x2a, 0xb4, 0xa0, 0x56, 0x13, 0x54, 0x06, 0x2e, 0xbb, 0x44, 0x6e, + 0x62, 0x82, 0x47, 0x62, 0x67, 0xb6, 0x53, 0xb1, 0xfd, 0x8a, 0xdd, 0x77, 0xda, 0xbf, 0xd8, 0x4f, + 0xe0, 0xc8, 0x71, 0xda, 0x01, 0x4d, 0xf0, 0x47, 0x26, 0x3b, 0x49, 0x07, 0xbb, 0x70, 0x7b, 0xef, + 0xf3, 0xf7, 0x3e, 0xbf, 0xf7, 0xf9, 0x25, 0xb0, 0x1e, 0x4d, 0xe3, 0xde, 0xf9, 0x54, 0xb2, 0x20, + 0xa4, 0xbd, 0xd9, 0x4e, 0x11, 0x76, 0x13, 0x29, 0xb4, 0x40, 0x8d, 0x68, 0x1a, 0x77, 0x0b, 0x68, + 0xb6, 0xb3, 0xb6, 0x12, 0x8a, 0x50, 0xd8, 0xa3, 0x9e, 0x89, 0x32, 0x56, 0xe7, 0x67, 0x19, 0xaa, + 0x13, 0x22, 0x49, 0xac, 0xd0, 0x18, 0x56, 0x44, 0x42, 0x25, 0xd1, 0x42, 0x7a, 0x5a, 0xa6, 0x4a, + 0x7b, 0x11, 0x9d, 0xd1, 0x68, 0xd5, 0xd9, 0x74, 0xb6, 0xea, 0xbb, 0xab, 0xdd, 0xc7, 0x7a, 0xdd, + 0x03, 0x49, 0x7c, 0xcd, 0x04, 0xc7, 0xa8, 0xa8, 0x3a, 0x35, 0x45, 0x1f, 0x4c, 0x8d, 0xd1, 0x0a, + 0x53, 0x22, 0x03, 0x46, 0xf8, 0x23, 0xad, 0xf2, 0x53, 0x5a, 0x45, 0xd5, 0x03, 0xad, 0x01, 0x3c, + 0xfb, 0x94, 0x06, 0x21, 0x7d, 0x24, 0xb4, 0xf0, 0x84, 0x50, 0xd3, 0x96, 0x3c, 0x50, 0x79, 0x0d, + 0x4d, 0xcd, 0x62, 0x1a, 0x09, 0xff, 0xd2, 0x4b, 0xa8, 0x64, 0x22, 0x58, 0xad, 0x6c, 0x3a, 0x5b, + 0x15, 0xdc, 0x28, 0xe0, 0x89, 0x45, 0x0d, 0x31, 0x91, 0x22, 0x11, 0x8a, 0x44, 0x05, 0x71, 0x31, + 0x23, 0x16, 0x70, 0x46, 0xec, 0xfc, 0x70, 0x60, 0x79, 0x22, 0xc5, 0x8c, 0x29, 0x26, 0xf8, 0x80, + 0x68, 0x82, 0x5a, 0xb0, 0xa0, 0xe8, 0x67, 0x6b, 0x58, 0x05, 0x9b, 0x10, 0x8d, 0xa1, 0x4a, 0x62, + 0x91, 0x72, 0x6d, 0x27, 0x77, 0xf7, 0x76, 0xaf, 0x6f, 0x37, 0x4a, 0xbf, 0x6f, 0x37, 0xb6, 0x43, + 0xa6, 0x2f, 0xd2, 0x69, 0xd7, 0x17, 0x71, 0xef, 0x80, 0x71, 0xe5, 0x5f, 0x30, 0xd2, 0x3b, 0xcf, + 0x83, 0x37, 0x2a, 0xb8, 0xec, 0xe9, 0x2f, 0x09, 0x55, 0xdd, 0x11, 0xd7, 0x38, 0x57, 0x40, 0xcf, + 0xa1, 0xaa, 0x28, 0x0f, 0xa8, 0xb4, 0xc3, 0xbb, 0x38, 0xcf, 0xd0, 0x1a, 0xd4, 0x24, 0xf5, 0x29, + 0x9b, 0x51, 0x69, 0x47, 0x72, 0xf1, 0x3c, 0xef, 0x7c, 0x85, 0xe6, 0xbc, 0xc5, 0x13, 0x4d, 0x74, + 0xaa, 0xd0, 0x4b, 0x58, 0x9a, 0x1b, 0x41, 0x79, 0x90, 0x77, 0x5b, 0x2f, 0xb0, 0x21, 0x0f, 0xd0, + 0x2b, 0x68, 0xf8, 0x82, 0x9f, 0x33, 0x19, 0x7b, 0xbe, 0xb9, 0x5a, 0xd9, 0xee, 0x17, 0xf1, 0x72, + 0x8e, 0xee, 0x5b, 0x10, 0xbd, 0x00, 0x60, 0xca, 0xf3, 0x23, 0xc2, 0x62, 0x1a, 0xd8, 0xa6, 0x6a, + 0xd8, 0x65, 0x6a, 0x3f, 0x03, 0x3a, 0x63, 0xa8, 0x15, 0xcf, 0x81, 0xd6, 0xc1, 0xe5, 0x69, 0x9c, + 0xad, 0x49, 0x7e, 0xe3, 0x3f, 0x00, 0x6d, 0x42, 0x3d, 0xa0, 0x5c, 0xc4, 0x8c, 0xdb, 0xf3, 0x72, + 0xd6, 0xd1, 0x03, 0xa8, 0xf3, 0xdd, 0x81, 0x25, 0x2c, 0x22, 0x3a, 0xc9, 0x9f, 0x00, 0x35, 0xa0, + 0xcc, 0x8a, 0xde, 0xcb, 0x2c, 0x30, 0x26, 0x64, 0xcf, 0x43, 0xb3, 0x7a, 0x17, 0xcf, 0x73, 0x63, + 0x9c, 0x26, 0x32, 0xa4, 0xba, 0x30, 0x2e, 0xcb, 0xd0, 0x16, 0x54, 0xa4, 0x88, 0xa8, 0x35, 0xad, + 0xb1, 0xbb, 0xf2, 0xff, 0x2e, 0x99, 0xfb, 0xb0, 0x65, 0x98, 0x49, 0xe9, 0x55, 0xc2, 0x24, 0x0d, + 0x3c, 0xa2, 0xf3, 0x75, 0x70, 0x73, 0xa4, 0xaf, 0xb7, 0xdf, 0x43, 0xc5, 0x90, 0x51, 0x13, 0xea, + 0x67, 0x47, 0x27, 0x93, 0xe1, 0xfe, 0xe8, 0x60, 0x34, 0x1c, 0xb4, 0x4a, 0x68, 0x09, 0x6a, 0x87, + 0x67, 0x7d, 0x3c, 0x18, 0xf5, 0x8f, 0x5a, 0x8e, 0xc9, 0x8e, 0x27, 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, 0xb9, 0x6b, 0x3b, 0xdf, 0xee, 0xdb, 0xa5, 0x9b, 0xfb, 0x76, 0xe9, + 0xd7, 0x7d, 0xbb, 0xf4, 0xf1, 0xed, 0x93, 0x7b, 0x72, 0x35, 0xff, 0x03, 0xd8, 0x8d, 0x99, 0x56, + 0xed, 0x77, 0xfd, 0xee, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x61, 0x80, 0x22, 0x79, 0x1d, 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 + } + if m.JudgeTrustLevel != nil { + { + 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 + } + if m.GuardianTrustLevel != nil { + { + 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 + } + if m.OperatorTrustLevel != nil { + { + 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 + if m.OperatorTrustLevel != nil { + l = m.OperatorTrustLevel.Size() + n += 1 + l + sovFbridge(uint64(l)) + } + if m.GuardianTrustLevel != nil { + l = m.GuardianTrustLevel.Size() + n += 1 + l + sovFbridge(uint64(l)) + } + if m.JudgeTrustLevel != nil { + 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 m.OperatorTrustLevel == nil { + m.OperatorTrustLevel = &Fraction{} + } + 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 m.GuardianTrustLevel == nil { + m.GuardianTrustLevel = &Fraction{} + } + 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 m.JudgeTrustLevel == nil { + m.JudgeTrustLevel = &Fraction{} + } + 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..58322550d4 --- /dev/null +++ b/x/fbridge/types/genesis.go @@ -0,0 +1,9 @@ +package types + +func DefaultGenesisState() *GenesisState { + return &GenesisState{} +} + +func ValidateGenesis(data GenesisState) error { + return nil +} diff --git a/x/fbridge/types/genesis.pb.go b/x/fbridge/types/genesis.pb.go new file mode 100644 index 0000000000..60dc09d4c7 --- /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,omitempty"` +} + +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{ + // 665 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x94, 0x4d, 0x6f, 0xd3, 0x4c, + 0x10, 0xc7, 0xe3, 0xc4, 0x4a, 0xdb, 0x69, 0xfa, 0xa2, 0xd5, 0xf3, 0x54, 0x6e, 0x28, 0x4e, 0x64, + 0x71, 0xe8, 0x01, 0x62, 0x0a, 0x48, 0xbc, 0xa8, 0x12, 0x52, 0x5a, 0xb5, 0x02, 0x09, 0x81, 0x6c, + 0x0e, 0xa8, 0x17, 0xcb, 0x76, 0x36, 0xee, 0xaa, 0xb1, 0xd7, 0xf6, 0x6e, 0xa2, 0xf6, 0x1b, 0x70, + 0xe4, 0xc6, 0x95, 0x0b, 0xdf, 0xa5, 0xc7, 0x1e, 0x39, 0x20, 0x84, 0xda, 0x2f, 0x82, 0xbc, 0x5d, + 0xbf, 0xc4, 0x6d, 0x25, 0xb8, 0xed, 0xee, 0xfc, 0xe7, 0x37, 0xff, 0x59, 0x8f, 0x17, 0xb6, 0x26, + 0x5e, 0x68, 0x8e, 0xbd, 0x94, 0x8c, 0x02, 0x6c, 0xce, 0x76, 0xcc, 0x00, 0x47, 0x98, 0x11, 0x36, + 0x88, 0x53, 0xca, 0x29, 0x5a, 0x9d, 0x78, 0xe1, 0x40, 0x46, 0x07, 0xb3, 0x9d, 0xee, 0x7f, 0x01, + 0x0d, 0xa8, 0x08, 0x99, 0xd9, 0xea, 0x5a, 0xd5, 0xad, 0x33, 0xf2, 0x04, 0x11, 0x35, 0x7e, 0x2a, + 0xd0, 0x39, 0xbc, 0xa6, 0xda, 0xdc, 0xe5, 0x18, 0x3d, 0x83, 0x76, 0xec, 0xa6, 0x6e, 0xc8, 0x34, + 0xa5, 0xaf, 0x6c, 0x2f, 0x3f, 0xd9, 0x18, 0xcc, 0x57, 0x19, 0x7c, 0x10, 0xd1, 0xa1, 0x7a, 0xfe, + 0xab, 0xd7, 0xb0, 0xa4, 0x16, 0x1d, 0xc2, 0x0a, 0xc3, 0xd1, 0x88, 0x44, 0x81, 0xc3, 0x32, 0x8c, + 0xd6, 0x14, 0xc9, 0x5b, 0xf5, 0x64, 0xfb, 0x5a, 0x24, 0x4a, 0x49, 0x44, 0x87, 0x55, 0xce, 0xd0, + 0x3b, 0x58, 0x4b, 0xb1, 0x8f, 0xc9, 0xac, 0x44, 0xb5, 0x04, 0x4a, 0xaf, 0xa3, 0xac, 0x5c, 0x56, + 0x85, 0xad, 0xa6, 0x73, 0xa7, 0xc6, 0x14, 0x3a, 0xd5, 0x92, 0x68, 0x13, 0x16, 0x23, 0x7c, 0xca, + 0x1d, 0x86, 0x13, 0xd1, 0x9f, 0x6a, 0x2d, 0x64, 0x7b, 0x1b, 0x27, 0x68, 0x1f, 0xd6, 0x18, 0x4e, + 0x1c, 0x4e, 0x1d, 0x6f, 0x42, 0xfd, 0x93, 0x68, 0x1a, 0x6a, 0xcd, 0x7e, 0xeb, 0xb6, 0x26, 0x86, + 0x59, 0xdc, 0xc6, 0xc9, 0x9b, 0x68, 0x4c, 0xad, 0x15, 0x86, 0x93, 0x8f, 0x74, 0x28, 0x53, 0x5e, + 0xa9, 0x9f, 0xbf, 0xf5, 0x1a, 0xc6, 0x2e, 0x74, 0xaa, 0x22, 0xb4, 0x0e, 0xad, 0xb2, 0x62, 0xb6, + 0x44, 0x5d, 0x58, 0xac, 0x94, 0xc9, 0x8e, 0x8b, 0xbd, 0xf1, 0x5d, 0x85, 0xd5, 0xf9, 0xee, 0x10, + 0x85, 0x07, 0x41, 0x8a, 0x5d, 0x8e, 0x19, 0x77, 0x7c, 0x1a, 0x31, 0xec, 0x4f, 0x39, 0x99, 0xe1, + 0xac, 0x0f, 0xc7, 0x3b, 0x73, 0x68, 0x8c, 0x53, 0x97, 0xd3, 0x54, 0x53, 0x84, 0xe3, 0x5e, 0xdd, + 0xf1, 0x7b, 0x19, 0xcf, 0x4d, 0xf7, 0x73, 0xd8, 0x5e, 0xc9, 0xb2, 0x71, 0x32, 0x3c, 0xcb, 0x85, + 0xe8, 0x13, 0x68, 0x45, 0xc1, 0x7a, 0x91, 0xe6, 0xdf, 0x15, 0xf9, 0x3f, 0x07, 0xcc, 0x93, 0x5f, + 0x54, 0xc8, 0xb5, 0x56, 0xc4, 0xa7, 0x56, 0xad, 0x8d, 0xdb, 0xdd, 0xa1, 0x87, 0x80, 0x62, 0x39, + 0x64, 0xfe, 0xc4, 0x25, 0x61, 0x96, 0xc2, 0x34, 0xb5, 0xdf, 0xda, 0x56, 0xad, 0x75, 0x19, 0xd9, + 0xcb, 0x02, 0x36, 0x4e, 0x18, 0xda, 0x85, 0x65, 0x9f, 0x86, 0x21, 0xe1, 0x21, 0x8e, 0x38, 0xd3, + 0xda, 0xc2, 0x74, 0xb7, 0x6e, 0x7a, 0xaf, 0x90, 0x58, 0x55, 0x39, 0x7a, 0x09, 0x10, 0xa7, 0x74, + 0x46, 0x18, 0xa1, 0x11, 0xd3, 0x16, 0x44, 0xf2, 0xe6, 0x8d, 0x5f, 0x21, 0x57, 0x58, 0x15, 0x31, + 0x72, 0xe1, 0x9e, 0x4f, 0xa3, 0x31, 0x49, 0x43, 0x3c, 0x72, 0xe4, 0x48, 0x95, 0x68, 0x6d, 0x51, + 0xb0, 0x8c, 0x9b, 0x46, 0x64, 0x4a, 0x09, 0xd5, 0x0a, 0x8c, 0x9d, 0xcd, 0x58, 0x69, 0x55, 0x4e, + 0xd9, 0x6b, 0x58, 0xab, 0xdd, 0x79, 0x36, 0x56, 0x95, 0x59, 0x50, 0xb6, 0x97, 0xac, 0x62, 0x9f, + 0x0f, 0x61, 0xb3, 0x18, 0x42, 0xe3, 0x08, 0xa0, 0x84, 0xfe, 0x5b, 0x2e, 0xd2, 0x01, 0x2a, 0x4d, + 0xb5, 0x84, 0xbe, 0x72, 0x62, 0x7c, 0x55, 0x60, 0xa9, 0x68, 0xa5, 0xa6, 0x56, 0xea, 0x6a, 0xb4, + 0x03, 0xea, 0xc8, 0xe5, 0xae, 0x7c, 0x36, 0xee, 0xdf, 0x79, 0xd1, 0xfb, 0x2e, 0x77, 0x2d, 0x21, + 0x45, 0xcf, 0xa1, 0x9d, 0xbd, 0x0f, 0x53, 0x26, 0x1f, 0x88, 0xde, 0x9d, 0x49, 0xb6, 0x90, 0x59, + 0x52, 0x6e, 0x1c, 0x00, 0xba, 0x79, 0xd9, 0xb7, 0xfc, 0xa2, 0xf3, 0x9e, 0x9b, 0x75, 0xcf, 0xc3, + 0xb7, 0xe7, 0x97, 0xba, 0x72, 0x71, 0xa9, 0x2b, 0xbf, 0x2f, 0x75, 0xe5, 0xcb, 0x95, 0xde, 0xb8, + 0xb8, 0xd2, 0x1b, 0x3f, 0xae, 0xf4, 0xc6, 0xd1, 0xe3, 0x80, 0xf0, 0xe3, 0xa9, 0x37, 0xf0, 0x69, + 0x68, 0x1e, 0x90, 0x88, 0xf9, 0xc7, 0xc4, 0x35, 0xc7, 0x72, 0xf1, 0x88, 0x8d, 0x4e, 0xcc, 0xd3, + 0xe2, 0x45, 0xe6, 0x67, 0x31, 0x66, 0x5e, 0x5b, 0xbc, 0xc6, 0x4f, 0xff, 0x04, 0x00, 0x00, 0xff, + 0xff, 0x4e, 0x85, 0xc3, 0xf2, 0xf1, 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..db369517f7 --- /dev/null +++ b/x/fbridge/types/keys.go @@ -0,0 +1,9 @@ +package types + +const ( + // ModuleName is the module name constant used in many places + ModuleName = "fbridge" + + // StoreKey is the store key string for distribution + StoreKey = ModuleName +) 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/query.pb.go b/x/fbridge/types/query.pb.go new file mode 100644 index 0000000000..d43ba5168b --- /dev/null +++ b/x/fbridge/types/query.pb.go @@ -0,0 +1,5094 @@ +// 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 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{4} +} +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{5} +} +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{6} +} +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{7} +} +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{8} +} +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{9} +} +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{10} +} +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{11} +} +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{12} +} +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{13} +} +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{14} +} +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{15} +} +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{16} +} +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{17} +} +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{18} +} +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{19} +} +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{20} +} +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{21} +} +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{22} +} +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{23} +} +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{24} +} +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{25} +} +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((*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{ + // 1152 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x57, 0xcf, 0x6f, 0x1b, 0x45, + 0x14, 0xce, 0xb6, 0x69, 0x14, 0x3f, 0x4b, 0x80, 0x86, 0x34, 0x4d, 0x4d, 0xb0, 0x93, 0x6d, 0x9b, + 0x86, 0x36, 0xd9, 0x8d, 0x4d, 0x94, 0x20, 0x9a, 0x0a, 0x94, 0xa0, 0x22, 0x8a, 0x54, 0x52, 0xa7, + 0x27, 0x2e, 0xd6, 0xda, 0x3b, 0xd9, 0x2e, 0xd8, 0x3b, 0xde, 0x9d, 0x75, 0x94, 0x28, 0xca, 0xa5, + 0x07, 0x2e, 0x08, 0x09, 0x89, 0x13, 0x17, 0xfe, 0x06, 0xa4, 0xfe, 0x03, 0x1c, 0x7b, 0xe0, 0x50, + 0x89, 0x0b, 0x27, 0x84, 0x12, 0xfe, 0x10, 0xb4, 0xb3, 0x6f, 0xc6, 0xf6, 0xae, 0xc7, 0x71, 0xb9, + 0x70, 0x9b, 0x7d, 0xf3, 0xbe, 0xef, 0x7d, 0x6f, 0x7e, 0x7d, 0x36, 0x94, 0xda, 0xcd, 0x8e, 0x7d, + 0xd8, 0x8c, 0x7c, 0xd7, 0xa3, 0xf6, 0x51, 0xd5, 0x0e, 0x7b, 0x34, 0x3a, 0xb1, 0xba, 0x11, 0x8b, + 0x19, 0x79, 0xab, 0xdd, 0xec, 0x58, 0x38, 0x67, 0x1d, 0x55, 0x4b, 0x8b, 0x1e, 0x63, 0x5e, 0x9b, + 0xda, 0x4e, 0xd7, 0xb7, 0x9d, 0x20, 0x60, 0xb1, 0x13, 0xfb, 0x2c, 0xe0, 0x69, 0x76, 0x69, 0xce, + 0x63, 0x1e, 0x13, 0x43, 0x3b, 0x19, 0x61, 0xf4, 0x5e, 0x8b, 0xf1, 0x0e, 0xe3, 0x76, 0xd3, 0xe1, + 0x34, 0x25, 0xb7, 0x8f, 0xaa, 0x4d, 0x1a, 0x3b, 0x55, 0xbb, 0xeb, 0x78, 0x7e, 0x20, 0x28, 0x30, + 0x77, 0x31, 0xa3, 0x45, 0x96, 0x16, 0xb3, 0xe6, 0x1c, 0x90, 0xa7, 0x09, 0x7e, 0xdf, 0x89, 0x9c, + 0x0e, 0xaf, 0xd3, 0xb0, 0x47, 0x79, 0x6c, 0x7e, 0x09, 0xef, 0x0e, 0x45, 0x79, 0x97, 0x05, 0x9c, + 0x92, 0x4d, 0x98, 0xe9, 0x8a, 0xc8, 0x82, 0xb1, 0x64, 0xac, 0x16, 0x6b, 0xf3, 0xd6, 0x70, 0x2f, + 0x56, 0x9a, 0xbf, 0x3b, 0xfd, 0xea, 0xaf, 0xca, 0x54, 0x1d, 0x73, 0xcd, 0x9b, 0x70, 0x43, 0x90, + 0x3d, 0xa1, 0xc7, 0xf1, 0x01, 0x0d, 0x0f, 0x68, 0xe0, 0xca, 0x3a, 0x6b, 0xb0, 0x90, 0x9f, 0xc2, + 0x62, 0xef, 0xc0, 0x55, 0x4e, 0x43, 0x51, 0x69, 0xba, 0x9e, 0x0c, 0xcd, 0x4f, 0x60, 0x59, 0x64, + 0x7f, 0x1e, 0x51, 0x27, 0xa6, 0x3c, 0x41, 0xec, 0x9e, 0x7c, 0xd5, 0xa5, 0x91, 0x13, 0xb3, 0x08, + 0x29, 0x49, 0x09, 0x66, 0x19, 0x86, 0x04, 0xb6, 0x50, 0x57, 0xdf, 0xe6, 0x16, 0x98, 0xe3, 0x08, + 0xb4, 0x85, 0xd7, 0xe1, 0xfe, 0x10, 0x6e, 0x2f, 0xc9, 0x6b, 0xf5, 0x62, 0xff, 0x88, 0xee, 0xb1, + 0xe0, 0xd0, 0x8f, 0x3a, 0xd4, 0x3d, 0xa0, 0xa1, 0xec, 0xea, 0x53, 0x58, 0x9b, 0x2c, 0x5d, 0x5b, + 0xf0, 0x09, 0x94, 0x05, 0xc3, 0x41, 0xaf, 0xd9, 0xf1, 0xe3, 0x98, 0xba, 0xfb, 0x11, 0x3b, 0xf2, + 0xb9, 0xcf, 0x82, 0x09, 0xda, 0x94, 0x7c, 0x57, 0xfa, 0x7c, 0x3f, 0x1b, 0x50, 0xd1, 0x12, 0xa2, + 0x8a, 0x6d, 0x98, 0x76, 0x9d, 0xd8, 0xc1, 0xad, 0x7d, 0x3f, 0xb7, 0xb5, 0x12, 0xf0, 0x99, 0x13, + 0x3b, 0xb8, 0xc3, 0x02, 0x40, 0x1e, 0xc2, 0x0c, 0x8f, 0x9d, 0xb8, 0xc7, 0x45, 0xc5, 0x62, 0xad, + 0xa2, 0x85, 0x1e, 0x88, 0x34, 0x79, 0x3c, 0x52, 0x90, 0xf9, 0x0c, 0x96, 0xf0, 0x0c, 0x50, 0x97, + 0xba, 0x42, 0x20, 0x17, 0xc9, 0x34, 0xe4, 0x93, 0x74, 0x3b, 0x07, 0xd7, 0x22, 0x27, 0xf0, 0x28, + 0xf6, 0x9b, 0x7e, 0x98, 0xdb, 0x78, 0x56, 0x46, 0xb3, 0x62, 0xcb, 0x04, 0xa6, 0x39, 0x0d, 0x93, + 0xd3, 0x7c, 0x75, 0x75, 0xba, 0x2e, 0xc6, 0x66, 0x0d, 0x97, 0x5e, 0xed, 0x54, 0x6e, 0xe9, 0xf3, + 0xdb, 0xa5, 0x96, 0x77, 0x14, 0xe8, 0x7f, 0x5e, 0xde, 0xfb, 0x78, 0xfb, 0xf6, 0x58, 0xa7, 0xe3, + 0xc7, 0x1d, 0x1a, 0xc4, 0x5c, 0xdf, 0xc8, 0x0e, 0xde, 0xc7, 0xa1, 0x64, 0x6c, 0x60, 0x09, 0x8a, + 0xad, 0x7e, 0x58, 0xac, 0x59, 0xa1, 0x3e, 0x18, 0x32, 0x6f, 0xc0, 0xf5, 0xf4, 0xdc, 0xf7, 0x9c, + 0xc8, 0xf5, 0x9d, 0x40, 0x3d, 0x27, 0x5b, 0x30, 0x9f, 0x9d, 0x40, 0xd2, 0x45, 0x28, 0x78, 0x32, + 0x88, 0x94, 0xfd, 0x80, 0x22, 0x94, 0x57, 0x34, 0x47, 0x38, 0x30, 0xd1, 0x27, 0x94, 0x27, 0x43, + 0x11, 0xaa, 0x80, 0x7a, 0xed, 0x1e, 0xf7, 0x5c, 0x8f, 0x2a, 0xb6, 0x75, 0x7c, 0xed, 0x64, 0x14, + 0xa9, 0xe6, 0x61, 0xe6, 0x1b, 0x11, 0x41, 0x1e, 0xfc, 0x32, 0x1b, 0xa8, 0x6a, 0x3f, 0x62, 0x5d, + 0xc6, 0x9d, 0xb6, 0x5a, 0xcf, 0x47, 0x00, 0xfd, 0xd7, 0x17, 0x37, 0x7a, 0xc5, 0x4a, 0x9f, 0x6a, + 0x2b, 0x79, 0xaa, 0xad, 0xd4, 0x07, 0xf0, 0xa9, 0xb6, 0xf6, 0x1d, 0x8f, 0x22, 0xb6, 0x3e, 0x80, + 0x34, 0x9f, 0x61, 0x77, 0x03, 0x05, 0x50, 0xd2, 0xc7, 0x50, 0xe8, 0xca, 0xa0, 0x50, 0x55, 0xac, + 0x2d, 0x66, 0x8f, 0x43, 0x9d, 0xb5, 0xa9, 0x44, 0xd6, 0xfb, 0xe9, 0xe6, 0x36, 0xcc, 0x0d, 0xb1, + 0x4a, 0xd5, 0x15, 0x28, 0xca, 0xa4, 0x86, 0xef, 0xe2, 0xf5, 0x02, 0x19, 0xfa, 0xc2, 0x35, 0x9f, + 0x66, 0xfa, 0x55, 0x6a, 0x3e, 0x82, 0x59, 0x99, 0x86, 0xdd, 0x8e, 0x17, 0xa3, 0xb2, 0x6b, 0x2f, + 0xdf, 0x86, 0x6b, 0x82, 0x93, 0x84, 0x30, 0x93, 0x9a, 0x06, 0x31, 0xb3, 0xd8, 0xbc, 0x2f, 0x95, + 0x6e, 0x8d, 0xcd, 0x49, 0x65, 0x99, 0xe5, 0x17, 0x7f, 0xfc, 0xf3, 0xd3, 0x95, 0x05, 0x32, 0x6f, + 0x67, 0x9c, 0x2f, 0xf5, 0x23, 0xf2, 0x9d, 0x01, 0xc5, 0x01, 0xc3, 0x21, 0x77, 0x47, 0x92, 0xe6, + 0xdd, 0xaa, 0xb4, 0x7a, 0x79, 0x22, 0x4a, 0xb8, 0x2d, 0x24, 0x94, 0xc9, 0x62, 0x56, 0x42, 0x40, + 0x8f, 0x63, 0x4e, 0xc3, 0x06, 0x4f, 0x0a, 0xff, 0x6a, 0xc0, 0xf5, 0x91, 0x56, 0x44, 0xaa, 0x23, + 0x2b, 0x8d, 0xf3, 0xbd, 0x52, 0xed, 0x4d, 0x20, 0x28, 0x73, 0x43, 0xc8, 0xbc, 0x47, 0x56, 0xb3, + 0x32, 0xd5, 0x8d, 0xb1, 0x4f, 0xe5, 0xf0, 0xcc, 0xe6, 0x34, 0x24, 0xbf, 0x1b, 0x50, 0xb9, 0xc4, + 0xd6, 0xc8, 0x83, 0xb1, 0x4a, 0xc6, 0x7b, 0x67, 0x69, 0xe7, 0xbf, 0x81, 0xb1, 0x21, 0x4b, 0x34, + 0xb4, 0x4a, 0x56, 0xb2, 0x0d, 0x79, 0x48, 0xd0, 0x68, 0x49, 0x58, 0x23, 0x69, 0xe7, 0xa5, 0x01, + 0x24, 0x6f, 0x89, 0xc4, 0x1a, 0x29, 0x42, 0x6b, 0xc6, 0x25, 0x7b, 0xe2, 0x7c, 0xd4, 0xb9, 0x23, + 0x74, 0x6e, 0x91, 0xcd, 0x89, 0x16, 0xbe, 0x2b, 0xf1, 0xf6, 0x29, 0xa7, 0xe1, 0x19, 0xf9, 0xc5, + 0x00, 0x92, 0x77, 0x1a, 0x8d, 0x6a, 0xad, 0x8f, 0x69, 0x54, 0xeb, 0x2d, 0xcc, 0xbc, 0x2b, 0x54, + 0x2f, 0x93, 0x4a, 0xee, 0x62, 0x65, 0x04, 0xfe, 0x66, 0xc0, 0xdc, 0x28, 0xe3, 0x25, 0x1b, 0x9a, + 0x1b, 0xa4, 0x75, 0xfe, 0x52, 0xf5, 0x0d, 0x10, 0x28, 0x73, 0x4f, 0xc8, 0x7c, 0x48, 0x1e, 0x4c, + 0xb4, 0xb8, 0x81, 0xa0, 0x6a, 0x70, 0xc5, 0x95, 0x1c, 0x0c, 0x4e, 0xbe, 0x37, 0xa0, 0x38, 0xe0, + 0x82, 0x9a, 0x47, 0x22, 0x6f, 0xaa, 0x9a, 0x47, 0x62, 0x84, 0xa1, 0x9a, 0x1f, 0x08, 0x9d, 0xb7, + 0xc8, 0x72, 0x56, 0xe7, 0x80, 0xa7, 0xe2, 0x82, 0x9e, 0x41, 0x41, 0x79, 0x27, 0xb9, 0x33, 0xfa, + 0x8a, 0x64, 0x4c, 0xb7, 0xb4, 0x72, 0x59, 0x1a, 0xca, 0x58, 0x16, 0x32, 0xde, 0x23, 0x37, 0x73, + 0x77, 0x46, 0x55, 0x3c, 0x83, 0x82, 0x72, 0x5a, 0x4d, 0xf9, 0xac, 0x45, 0x6b, 0xca, 0xe7, 0x0c, + 0x5b, 0x5f, 0x5e, 0xed, 0x56, 0xe2, 0x11, 0xa9, 0x35, 0x6b, 0x3c, 0x62, 0xc8, 0xcd, 0x35, 0x1e, + 0x31, 0xec, 0xed, 0x7a, 0x8f, 0x48, 0x3d, 0x9e, 0xbc, 0x30, 0xa0, 0xa0, 0xec, 0x57, 0xd3, 0x72, + 0xd6, 0xff, 0x35, 0x2d, 0xe7, 0x5c, 0xdc, 0x5c, 0x11, 0xc5, 0x97, 0x48, 0x39, 0x5b, 0x3c, 0x62, + 0x6d, 0x6a, 0x2b, 0xc7, 0x26, 0x3f, 0x18, 0x30, 0x2b, 0xd1, 0xe4, 0xf6, 0x58, 0x72, 0x29, 0xe1, + 0xce, 0x25, 0x59, 0xa8, 0x60, 0x53, 0x28, 0xb0, 0xc8, 0xda, 0x78, 0x05, 0xf6, 0xe9, 0xc0, 0x2f, + 0x83, 0xb3, 0xdd, 0xc7, 0xaf, 0xce, 0xcb, 0xc6, 0xeb, 0xf3, 0xb2, 0xf1, 0xf7, 0x79, 0xd9, 0xf8, + 0xf1, 0xa2, 0x3c, 0xf5, 0xfa, 0xa2, 0x3c, 0xf5, 0xe7, 0x45, 0x79, 0xea, 0xeb, 0x0d, 0xcf, 0x8f, + 0x9f, 0xf7, 0x9a, 0x56, 0x8b, 0x75, 0xec, 0x47, 0x7e, 0xc0, 0x5b, 0xcf, 0x7d, 0xc7, 0x3e, 0xc4, + 0xc1, 0x3a, 0x77, 0xbf, 0xb5, 0x8f, 0x55, 0x95, 0xf8, 0xa4, 0x4b, 0x79, 0x73, 0x46, 0xfc, 0xfd, + 0xfc, 0xf0, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x46, 0xe7, 0x3d, 0x95, 0x2a, 0x0f, 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) + // 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) 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) + // 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) 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_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: "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 *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 { + dAtA5 := make([]byte, len(m.Seqs)*10) + var j4 int + for _, num := range m.Seqs { + 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 *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 *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 *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..8de3ab8ffe --- /dev/null +++ b/x/fbridge/types/query.pb.gw.go @@ -0,0 +1,1166 @@ +// 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 + +} + +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_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_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}, []string{"lbm", "fbridge", "v1", "nextseq_send"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_GreatestSeqByOperator_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"lbm", "fbridge", "v1", "operators", "operator", "seq"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_GreatestConsecutiveConfirmedSeq_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"lbm", "fbridge", "v1", "greatest_confirmed_seq"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_SubmittedProvision_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5, 1, 0, 4, 1, 5, 6}, []string{"lbm", "fbridge", "v1", "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, 1, 0, 4, 1, 5, 4}, []string{"lbm", "fbridge", "v1", "provision", "seq"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_NeededSubmissionSeqs_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"lbm", "fbridge", "v1", "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, 1, 0, 4, 1, 5, 4}, []string{"lbm", "fbridge", "v1", "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_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") +) From 7b421db2df6e8fec292ea78b655bde4aea0084a7 Mon Sep 17 00:00:00 2001 From: Jayden Lee <41176085+tkxkd0159@users.noreply.github.com> Date: Thu, 2 May 2024 14:32:50 +0900 Subject: [PATCH 4/7] feat: fbridge transfer (#1347) * impl bridge transfer tx/query * add CLI --- CHANGELOG.md | 3 +- Makefile | 1 + proto/lbm/fbridge/v1/fbridge.proto | 6 +- simapp/app.go | 14 ++ x/fbridge/client/cli/query.go | 31 +++- x/fbridge/client/cli/tx.go | 48 ++++- x/fbridge/keeper/genesis.go | 8 +- x/fbridge/keeper/grpc_query.go | 15 +- x/fbridge/keeper/keeper.go | 59 +++++- x/fbridge/keeper/msg_server.go | 49 +++-- x/fbridge/keeper/transfer.go | 87 +++++++++ x/fbridge/keeper/transfer_test.go | 62 +++++++ x/fbridge/testutil/expected_keepers_mocks.go | 119 ++++++++++++ x/fbridge/testutil/setup.go | 75 ++++++++ x/fbridge/types/expected_keepers.go | 14 ++ x/fbridge/types/fbridge.pb.go | 179 ++++++++----------- x/fbridge/types/genesis.go | 23 ++- x/fbridge/types/keys.go | 5 + x/fbridge/types/params.go | 1 + 19 files changed, 676 insertions(+), 123 deletions(-) create mode 100644 x/fbridge/keeper/transfer.go create mode 100644 x/fbridge/keeper/transfer_test.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/params.go diff --git a/CHANGELOG.md b/CHANGELOG.md index b1613e11c0..3fe176f455 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,7 +42,8 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (consensus) [\#1178](https://github.com/Finschia/finschia-sdk/pull/1178) change the consensus from Ostracon to Tendermint v0.34.24 * (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) [\#1336](https://github.com/Finschia/finschia-sdk/pull/1340) Initialize fbridge module +* (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) ### Improvements * (docs) [\#1120](https://github.com/Finschia/finschia-sdk/pull/1120) Update links in x/foundation README.md diff --git a/Makefile b/Makefile index fdd954145c..8504265a2a 100644 --- a/Makefile +++ b/Makefile @@ -145,6 +145,7 @@ mocks: $(MOCKS_DIR) mockgen -package mocks -destination tests/mocks/tendermint_tendermint_libs_log_DB.go github.com/tendermint/tendermint/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/proto/lbm/fbridge/v1/fbridge.proto b/proto/lbm/fbridge/v1/fbridge.proto index 58b1054ef3..6db9506e53 100644 --- a/proto/lbm/fbridge/v1/fbridge.proto +++ b/proto/lbm/fbridge/v1/fbridge.proto @@ -7,11 +7,11 @@ import "gogoproto/gogo.proto"; message Params { // ratio of how many operators' confirmations are needed to be valid. - Fraction operator_trust_level = 1; + Fraction operator_trust_level = 1 [(gogoproto.nullable) = false]; // ratio of how many guardians' confirmations are needed to be valid. - Fraction guardian_trust_level = 2; + Fraction guardian_trust_level = 2 [(gogoproto.nullable) = false]; // ratio of how many judges' confirmations are needed to be valid. - Fraction judge_trust_level = 3; + 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 diff --git a/simapp/app.go b/simapp/app.go index 148cdbc50c..f6ce763cdd 100644 --- a/simapp/app.go +++ b/simapp/app.go @@ -65,6 +65,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" @@ -142,6 +145,7 @@ var ( tokenmodule.AppModuleBasic{}, collectionmodule.AppModuleBasic{}, fswap.AppModuleBasic{}, + fbridgemodule.AppModuleBasic{}, ) // module account permissions @@ -154,11 +158,13 @@ var ( stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking}, stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking}, govtypes.ModuleName: {authtypes.Burner}, + fbridgetypes.ModuleName: {authtypes.Burner}, } // 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 +208,7 @@ type SimApp struct { TokenKeeper tokenkeeper.Keeper CollectionKeeper collectionkeeper.Keeper FswapKeeper fswapkeeper.Keeper + FbridgeKeeper fbridgekeeper.Keeper // the module manager mm *module.Manager @@ -256,6 +263,7 @@ func NewSimApp( 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 @@ -362,6 +370,8 @@ func NewSimApp( fswapConfig := fswaptypes.DefaultConfig() app.FswapKeeper = fswapkeeper.NewKeeper(appCodec, keys[fswaptypes.StoreKey], app.AccountKeeper, app.BankKeeper, fswapConfig) + 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 @@ -394,6 +404,7 @@ func NewSimApp( collectionmodule.NewAppModule(appCodec, app.CollectionKeeper), authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry), fswap.NewAppModule(appCodec, app.FswapKeeper, app.AccountKeeper, app.BankKeeper), + fbridgemodule.NewAppModule(appCodec, app.FbridgeKeeper), ) // During begin block slashing happens after distr.BeginBlocker so that @@ -422,6 +433,7 @@ func NewSimApp( token.ModuleName, collection.ModuleName, fswaptypes.ModuleName, + fbridgetypes.ModuleName, ) app.mm.SetOrderEndBlockers( crisistypes.ModuleName, @@ -444,6 +456,7 @@ func NewSimApp( token.ModuleName, collection.ModuleName, fswaptypes.ModuleName, + fbridgetypes.ModuleName, ) // NOTE: The genutils module must occur after staking so that pools are @@ -472,6 +485,7 @@ func NewSimApp( 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 index 6ef6d0424a..10cd8c5588 100644 --- a/x/fbridge/client/cli/query.go +++ b/x/fbridge/client/cli/query.go @@ -3,16 +3,45 @@ 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/x/fbridge/types" ) +// 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() + cmd.AddCommand( + NewQueryNextSeqSendCmd(), + ) return cmd } + +func NewQueryNextSeqSendCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "nextseq-send", + 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 +} diff --git a/x/fbridge/client/cli/tx.go b/x/fbridge/client/cli/tx.go index ef9ef1f04c..8aa3b892bb 100644 --- a/x/fbridge/client/cli/tx.go +++ b/x/fbridge/client/cli/tx.go @@ -4,10 +4,14 @@ 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" ) -// GetTxCmd returns the transaction commands for this module +// NewTxCmd returns the transaction commands for fbridge module func NewTxCmd() *cobra.Command { TxCmd := &cobra.Command{ Use: types.ModuleName, @@ -17,7 +21,47 @@ func NewTxCmd() *cobra.Command { RunE: client.ValidateCmd, } - TxCmd.AddCommand() + 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 index 42ffc544d4..a0b492207e 100644 --- a/x/fbridge/keeper/genesis.go +++ b/x/fbridge/keeper/genesis.go @@ -6,9 +6,15 @@ import ( ) func (k Keeper) InitGenesis(ctx sdk.Context, gs *types.GenesisState) error { + k.setNextSequence(ctx, gs.SendingState.NextSeq) + return nil } func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { - return nil + return &types.GenesisState{ + SendingState: types.SendingState{ + NextSeq: k.GetNextSequence(ctx), + }, + } } diff --git a/x/fbridge/keeper/grpc_query.go b/x/fbridge/keeper/grpc_query.go index c157e03e30..4953a0a5ef 100644 --- a/x/fbridge/keeper/grpc_query.go +++ b/x/fbridge/keeper/grpc_query.go @@ -3,6 +3,10 @@ package keeper import ( "context" + "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" ) @@ -12,8 +16,15 @@ func (k Keeper) Params(ctx context.Context, request *types.QueryParamsRequest) ( panic("implement me") } -func (k Keeper) NextSeqSend(ctx context.Context, request *types.QueryNextSeqSendRequest) (*types.QueryNextSeqSendResponse, 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) GreatestSeqByOperator(ctx context.Context, request *types.QueryGreatestSeqByOperatorRequest) (*types.QueryGreatestSeqByOperatorResponse, error) { diff --git a/x/fbridge/keeper/keeper.go b/x/fbridge/keeper/keeper.go index d22a739529..6059da88bc 100644 --- a/x/fbridge/keeper/keeper.go +++ b/x/fbridge/keeper/keeper.go @@ -1,3 +1,60 @@ package keeper -type Keeper struct{} +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 index 58d79ed1b1..491f57c632 100644 --- a/x/fbridge/keeper/msg_server.go +++ b/x/fbridge/keeper/msg_server.go @@ -3,6 +3,8 @@ 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" ) @@ -16,43 +18,68 @@ func NewMsgServer(k Keeper) types.MsgServer { return &msgServer{k} } -func (m msgServer) Transfer(ctx context.Context, transfer *types.MsgTransfer) (*types.MsgTransferResponse, error) { - panic("implement me") +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, provision *types.MsgProvision) (*types.MsgProvisionResponse, error) { +func (m msgServer) Provision(ctx context.Context, msg *types.MsgProvision) (*types.MsgProvisionResponse, error) { panic("implement me") } -func (m msgServer) HoldTransfer(ctx context.Context, transfer *types.MsgHoldTransfer) (*types.MsgHoldTransferResponse, error) { +func (m msgServer) HoldTransfer(ctx context.Context, msg *types.MsgHoldTransfer) (*types.MsgHoldTransferResponse, error) { panic("implement me") } -func (m msgServer) ReleaseTransfer(ctx context.Context, transfer *types.MsgReleaseTransfer) (*types.MsgReleaseTransferResponse, error) { +func (m msgServer) ReleaseTransfer(ctx context.Context, msg *types.MsgReleaseTransfer) (*types.MsgReleaseTransferResponse, error) { panic("implement me") } -func (m msgServer) RemoveProvision(ctx context.Context, provision *types.MsgRemoveProvision) (*types.MsgRemoveProvisionResponse, error) { +func (m msgServer) RemoveProvision(ctx context.Context, msg *types.MsgRemoveProvision) (*types.MsgRemoveProvisionResponse, error) { panic("implement me") } -func (m msgServer) ClaimBatch(ctx context.Context, batch *types.MsgClaimBatch) (*types.MsgClaimBatchResponse, error) { +func (m msgServer) ClaimBatch(ctx context.Context, msg *types.MsgClaimBatch) (*types.MsgClaimBatchResponse, error) { panic("implement me") } -func (m msgServer) Claim(ctx context.Context, claim *types.MsgClaim) (*types.MsgClaimResponse, error) { +func (m msgServer) Claim(ctx context.Context, msg *types.MsgClaim) (*types.MsgClaimResponse, error) { panic("implement me") } -func (m msgServer) SuggestRole(ctx context.Context, role *types.MsgSuggestRole) (*types.MsgSuggestRoleResponse, error) { +func (m msgServer) SuggestRole(ctx context.Context, msg *types.MsgSuggestRole) (*types.MsgSuggestRoleResponse, error) { panic("implement me") } -func (m msgServer) AddVoteForRole(ctx context.Context, role *types.MsgAddVoteForRole) (*types.MsgAddVoteForRoleResponse, error) { +func (m msgServer) AddVoteForRole(ctx context.Context, msg *types.MsgAddVoteForRole) (*types.MsgAddVoteForRoleResponse, error) { panic("implement me") } -func (m msgServer) Halt(ctx context.Context, halt *types.MsgHalt) (*types.MsgHaltResponse, error) { +func (m msgServer) Halt(ctx context.Context, msg *types.MsgHalt) (*types.MsgHaltResponse, error) { panic("implement me") } diff --git a/x/fbridge/keeper/transfer.go b/x/fbridge/keeper/transfer.go new file mode 100644 index 0000000000..c1c1f65b6f --- /dev/null +++ b/x/fbridge/keeper/transfer.go @@ -0,0 +1,87 @@ +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) + + return seq, 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..b0bdc05849 --- /dev/null +++ b/x/fbridge/keeper/transfer_test.go @@ -0,0 +1,62 @@ +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) +} + +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/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/expected_keepers.go b/x/fbridge/types/expected_keepers.go index ab1254f4c2..ea23be5d64 100644 --- a/x/fbridge/types/expected_keepers.go +++ b/x/fbridge/types/expected_keepers.go @@ -1 +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 index 9ca2c7a57a..a9b8197a74 100644 --- a/x/fbridge/types/fbridge.pb.go +++ b/x/fbridge/types/fbridge.pb.go @@ -58,11 +58,11 @@ func (Role) EnumDescriptor() ([]byte, []int) { 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,omitempty"` + 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,omitempty"` + 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,omitempty"` + 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 @@ -102,25 +102,25 @@ func (m *Params) XXX_DiscardUnknown() { var xxx_messageInfo_Params proto.InternalMessageInfo -func (m *Params) GetOperatorTrustLevel() *Fraction { +func (m *Params) GetOperatorTrustLevel() Fraction { if m != nil { return m.OperatorTrustLevel } - return nil + return Fraction{} } -func (m *Params) GetGuardianTrustLevel() *Fraction { +func (m *Params) GetGuardianTrustLevel() Fraction { if m != nil { return m.GuardianTrustLevel } - return nil + return Fraction{} } -func (m *Params) GetJudgeTrustLevel() *Fraction { +func (m *Params) GetJudgeTrustLevel() Fraction { if m != nil { return m.JudgeTrustLevel } - return nil + return Fraction{} } func (m *Params) GetTimelockPeriod() uint64 { @@ -418,46 +418,46 @@ func init() { func init() { proto.RegisterFile("lbm/fbridge/v1/fbridge.proto", fileDescriptor_62374d75fc6aa1ba) } var fileDescriptor_62374d75fc6aa1ba = []byte{ - // 610 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x54, 0x41, 0x4f, 0xdb, 0x30, - 0x14, 0x6e, 0x4a, 0xa9, 0x9a, 0x57, 0x68, 0x3b, 0x0b, 0x4d, 0x08, 0xb1, 0xc2, 0x2a, 0x4d, 0x43, - 0x48, 0x6b, 0x07, 0xbb, 0x4f, 0x2a, 0xb4, 0xa0, 0x56, 0x13, 0x54, 0x06, 0x2e, 0xbb, 0x44, 0x6e, - 0x62, 0x82, 0x47, 0x62, 0x67, 0xb6, 0x53, 0xb1, 0xfd, 0x8a, 0xdd, 0x77, 0xda, 0xbf, 0xd8, 0x4f, - 0xe0, 0xc8, 0x71, 0xda, 0x01, 0x4d, 0xf0, 0x47, 0x26, 0x3b, 0x49, 0x07, 0xbb, 0x70, 0x7b, 0xef, - 0xf3, 0xf7, 0x3e, 0xbf, 0xf7, 0xf9, 0x25, 0xb0, 0x1e, 0x4d, 0xe3, 0xde, 0xf9, 0x54, 0xb2, 0x20, - 0xa4, 0xbd, 0xd9, 0x4e, 0x11, 0x76, 0x13, 0x29, 0xb4, 0x40, 0x8d, 0x68, 0x1a, 0x77, 0x0b, 0x68, - 0xb6, 0xb3, 0xb6, 0x12, 0x8a, 0x50, 0xd8, 0xa3, 0x9e, 0x89, 0x32, 0x56, 0xe7, 0x67, 0x19, 0xaa, - 0x13, 0x22, 0x49, 0xac, 0xd0, 0x18, 0x56, 0x44, 0x42, 0x25, 0xd1, 0x42, 0x7a, 0x5a, 0xa6, 0x4a, - 0x7b, 0x11, 0x9d, 0xd1, 0x68, 0xd5, 0xd9, 0x74, 0xb6, 0xea, 0xbb, 0xab, 0xdd, 0xc7, 0x7a, 0xdd, - 0x03, 0x49, 0x7c, 0xcd, 0x04, 0xc7, 0xa8, 0xa8, 0x3a, 0x35, 0x45, 0x1f, 0x4c, 0x8d, 0xd1, 0x0a, - 0x53, 0x22, 0x03, 0x46, 0xf8, 0x23, 0xad, 0xf2, 0x53, 0x5a, 0x45, 0xd5, 0x03, 0xad, 0x01, 0x3c, - 0xfb, 0x94, 0x06, 0x21, 0x7d, 0x24, 0xb4, 0xf0, 0x84, 0x50, 0xd3, 0x96, 0x3c, 0x50, 0x79, 0x0d, - 0x4d, 0xcd, 0x62, 0x1a, 0x09, 0xff, 0xd2, 0x4b, 0xa8, 0x64, 0x22, 0x58, 0xad, 0x6c, 0x3a, 0x5b, - 0x15, 0xdc, 0x28, 0xe0, 0x89, 0x45, 0x0d, 0x31, 0x91, 0x22, 0x11, 0x8a, 0x44, 0x05, 0x71, 0x31, - 0x23, 0x16, 0x70, 0x46, 0xec, 0xfc, 0x70, 0x60, 0x79, 0x22, 0xc5, 0x8c, 0x29, 0x26, 0xf8, 0x80, - 0x68, 0x82, 0x5a, 0xb0, 0xa0, 0xe8, 0x67, 0x6b, 0x58, 0x05, 0x9b, 0x10, 0x8d, 0xa1, 0x4a, 0x62, - 0x91, 0x72, 0x6d, 0x27, 0x77, 0xf7, 0x76, 0xaf, 0x6f, 0x37, 0x4a, 0xbf, 0x6f, 0x37, 0xb6, 0x43, - 0xa6, 0x2f, 0xd2, 0x69, 0xd7, 0x17, 0x71, 0xef, 0x80, 0x71, 0xe5, 0x5f, 0x30, 0xd2, 0x3b, 0xcf, - 0x83, 0x37, 0x2a, 0xb8, 0xec, 0xe9, 0x2f, 0x09, 0x55, 0xdd, 0x11, 0xd7, 0x38, 0x57, 0x40, 0xcf, - 0xa1, 0xaa, 0x28, 0x0f, 0xa8, 0xb4, 0xc3, 0xbb, 0x38, 0xcf, 0xd0, 0x1a, 0xd4, 0x24, 0xf5, 0x29, - 0x9b, 0x51, 0x69, 0x47, 0x72, 0xf1, 0x3c, 0xef, 0x7c, 0x85, 0xe6, 0xbc, 0xc5, 0x13, 0x4d, 0x74, - 0xaa, 0xd0, 0x4b, 0x58, 0x9a, 0x1b, 0x41, 0x79, 0x90, 0x77, 0x5b, 0x2f, 0xb0, 0x21, 0x0f, 0xd0, - 0x2b, 0x68, 0xf8, 0x82, 0x9f, 0x33, 0x19, 0x7b, 0xbe, 0xb9, 0x5a, 0xd9, 0xee, 0x17, 0xf1, 0x72, - 0x8e, 0xee, 0x5b, 0x10, 0xbd, 0x00, 0x60, 0xca, 0xf3, 0x23, 0xc2, 0x62, 0x1a, 0xd8, 0xa6, 0x6a, - 0xd8, 0x65, 0x6a, 0x3f, 0x03, 0x3a, 0x63, 0xa8, 0x15, 0xcf, 0x81, 0xd6, 0xc1, 0xe5, 0x69, 0x9c, - 0xad, 0x49, 0x7e, 0xe3, 0x3f, 0x00, 0x6d, 0x42, 0x3d, 0xa0, 0x5c, 0xc4, 0x8c, 0xdb, 0xf3, 0x72, - 0xd6, 0xd1, 0x03, 0xa8, 0xf3, 0xdd, 0x81, 0x25, 0x2c, 0x22, 0x3a, 0xc9, 0x9f, 0x00, 0x35, 0xa0, - 0xcc, 0x8a, 0xde, 0xcb, 0x2c, 0x30, 0x26, 0x64, 0xcf, 0x43, 0xb3, 0x7a, 0x17, 0xcf, 0x73, 0x63, - 0x9c, 0x26, 0x32, 0xa4, 0xba, 0x30, 0x2e, 0xcb, 0xd0, 0x16, 0x54, 0xa4, 0x88, 0xa8, 0x35, 0xad, - 0xb1, 0xbb, 0xf2, 0xff, 0x2e, 0x99, 0xfb, 0xb0, 0x65, 0x98, 0x49, 0xe9, 0x55, 0xc2, 0x24, 0x0d, - 0x3c, 0xa2, 0xf3, 0x75, 0x70, 0x73, 0xa4, 0xaf, 0xb7, 0xdf, 0x43, 0xc5, 0x90, 0x51, 0x13, 0xea, - 0x67, 0x47, 0x27, 0x93, 0xe1, 0xfe, 0xe8, 0x60, 0x34, 0x1c, 0xb4, 0x4a, 0x68, 0x09, 0x6a, 0x87, - 0x67, 0x7d, 0x3c, 0x18, 0xf5, 0x8f, 0x5a, 0x8e, 0xc9, 0x8e, 0x27, 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, 0xb9, 0x6b, 0x3b, 0xdf, 0xee, 0xdb, 0xa5, 0x9b, 0xfb, 0x76, 0xe9, - 0xd7, 0x7d, 0xbb, 0xf4, 0xf1, 0xed, 0x93, 0x7b, 0x72, 0x35, 0xff, 0x03, 0xd8, 0x8d, 0x99, 0x56, - 0xed, 0x77, 0xfd, 0xee, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x61, 0x80, 0x22, 0x79, 0x1d, 0x04, - 0x00, 0x00, + // 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) { @@ -490,42 +490,36 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x20 } - if m.JudgeTrustLevel != nil { - { - size, err := m.JudgeTrustLevel.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintFbridge(dAtA, i, uint64(size)) + { + size, err := m.JudgeTrustLevel.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } - i-- - dAtA[i] = 0x1a + i -= size + i = encodeVarintFbridge(dAtA, i, uint64(size)) } - if m.GuardianTrustLevel != nil { - { - size, err := m.GuardianTrustLevel.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-- - dAtA[i] = 0x12 + i -= size + i = encodeVarintFbridge(dAtA, i, uint64(size)) } - if m.OperatorTrustLevel != nil { - { - size, err := m.OperatorTrustLevel.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-- - dAtA[i] = 0xa + i -= size + i = encodeVarintFbridge(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0xa return len(dAtA) - i, nil } @@ -726,18 +720,12 @@ func (m *Params) Size() (n int) { } var l int _ = l - if m.OperatorTrustLevel != nil { - l = m.OperatorTrustLevel.Size() - n += 1 + l + sovFbridge(uint64(l)) - } - if m.GuardianTrustLevel != nil { - l = m.GuardianTrustLevel.Size() - n += 1 + l + sovFbridge(uint64(l)) - } - if m.JudgeTrustLevel != nil { - l = m.JudgeTrustLevel.Size() - n += 1 + l + sovFbridge(uint64(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)) } @@ -892,9 +880,6 @@ func (m *Params) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.OperatorTrustLevel == nil { - m.OperatorTrustLevel = &Fraction{} - } if err := m.OperatorTrustLevel.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -928,9 +913,6 @@ func (m *Params) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.GuardianTrustLevel == nil { - m.GuardianTrustLevel = &Fraction{} - } if err := m.GuardianTrustLevel.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -964,9 +946,6 @@ func (m *Params) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.JudgeTrustLevel == nil { - m.JudgeTrustLevel = &Fraction{} - } if err := m.JudgeTrustLevel.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } diff --git a/x/fbridge/types/genesis.go b/x/fbridge/types/genesis.go index 58322550d4..07af6f9677 100644 --- a/x/fbridge/types/genesis.go +++ b/x/fbridge/types/genesis.go @@ -1,9 +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{} + 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/keys.go b/x/fbridge/types/keys.go index db369517f7..03179de065 100644 --- a/x/fbridge/types/keys.go +++ b/x/fbridge/types/keys.go @@ -7,3 +7,8 @@ const ( // 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 +) 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 From 8d79d259a53f1bf0e43e742b7673291a4cda20c2 Mon Sep 17 00:00:00 2001 From: Jayden Lee <41176085+tkxkd0159@users.noreply.github.com> Date: Fri, 3 May 2024 20:26:54 +0900 Subject: [PATCH 5/7] feat: save sequence for every bridge request (#1351) * feat: add SeqToBlocknum * add CHANGELOG * add query bound for SeqToBlocknums --- CHANGELOG.md | 1 + client/docs/swagger-ui/swagger.yaml | 319 ++++++++----- docs/core/proto-docs.md | 47 +- proto/lbm/fbridge/v1/fbridge.proto | 2 +- proto/lbm/fbridge/v1/genesis.proto | 2 +- proto/lbm/fbridge/v1/query.proto | 30 +- x/fbridge/client/cli/query.go | 47 +- x/fbridge/keeper/genesis.go | 24 +- x/fbridge/keeper/grpc_query.go | 25 + x/fbridge/keeper/transfer.go | 18 + x/fbridge/keeper/transfer_test.go | 3 + x/fbridge/types/genesis.pb.go | 90 ++-- x/fbridge/types/keys.go | 13 +- x/fbridge/types/query.pb.go | 708 ++++++++++++++++++++++++---- x/fbridge/types/query.pb.gw.go | 94 +++- 15 files changed, 1116 insertions(+), 307 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3fe176f455..fdb019c12f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (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) ### Improvements * (docs) [\#1120](https://github.com/Finschia/finschia-sdk/pull/1120) Update links in x/foundation README.md diff --git a/client/docs/swagger-ui/swagger.yaml b/client/docs/swagger-ui/swagger.yaml index c56e21d150..30b1c66412 100644 --- a/client/docs/swagger-ui/swagger.yaml +++ b/client/docs/swagger-ui/swagger.yaml @@ -29799,17 +29799,17 @@ paths: format: byte tags: - Service - '/lbm/fbridge/v1/commitments/{seq}': + /lbm/fbridge/v1/guardians: get: - summary: Commitments queries commitments of a specific sequence number - operationId: FBridgeCommitments + summary: Guardians queries a list of Guardians registered on the bridge + operationId: FBridgeGuardians responses: '200': description: A successful response. schema: type: object properties: - commitments: + guardians: type: array items: type: string @@ -29835,30 +29835,22 @@ paths: value: type: string format: byte - parameters: - - name: seq - description: the sequence number of the bridge request - in: path - required: true - type: string - format: uint64 tags: - Query - /lbm/fbridge/v1/greatest_confirmed_seq: + /lbm/fbridge/v1/judges: get: - summary: >- - GreatestConsecutiveConfirmedSeq queries a greatest consecutive sequence - number confirmed by n-of-m operators - operationId: GreatestConsecutiveConfirmedSeq + summary: Judges queries a list of Judges registered on the bridge + operationId: FBridgeJudges responses: '200': description: A successful response. schema: type: object properties: - seq: - type: string - format: uint64 + judges: + type: array + items: + type: string default: description: An unexpected error response schema: @@ -29883,17 +29875,17 @@ paths: format: byte tags: - Query - /lbm/fbridge/v1/guardians: + /lbm/fbridge/v1/operators: get: - summary: Guardians queries a list of Guardians registered on the bridge - operationId: FBridgeGuardians + summary: Operators queries a list of Operators registered on the bridge + operationId: FBridgeOperators responses: '200': description: A successful response. schema: type: object properties: - guardians: + operators: type: array items: type: string @@ -29921,20 +29913,65 @@ paths: format: byte tags: - Query - /lbm/fbridge/v1/judges: + /lbm/fbridge/v1/params: get: - summary: Judges queries a list of Judges registered on the bridge - operationId: FBridgeJudges + summary: Params queries the parameters of x/fbridge module. + operationId: FBridgeParams responses: '200': description: A successful response. schema: type: object properties: - judges: - type: array - items: - type: string + params: + type: object + properties: + operator_trust_level: + description: >- + ratio of how many operators' confirmations are needed to + be valid. + type: object + properties: + numerator: + type: string + format: uint64 + denominator: + type: string + format: uint64 + guardian_trust_level: + description: >- + ratio of how many guardians' confirmations are needed to + be valid. + type: object + properties: + numerator: + type: string + format: uint64 + denominator: + type: string + format: uint64 + judge_trust_level: + description: >- + ratio of how many judges' confirmations are needed to be + valid. + type: object + properties: + numerator: + type: string + format: uint64 + denominator: + type: string + format: uint64 + timelock_period: + type: string + format: uint64 + title: >- + default timelock period for each provision (unix + timestamp) + proposal_period: + type: string + format: uint64 + title: default period of the proposal to update the role default: description: An unexpected error response schema: @@ -29959,19 +29996,20 @@ paths: format: byte tags: - Query - /lbm/fbridge/v1/nextseq_send: + '/lbm/fbridge/v1/receiving/commitments/{seq}': get: - summary: NextSeqSend queries the sequence of next bridge request - operationId: NextSeqSend + summary: Commitments queries commitments of a specific sequence number + operationId: FBridgeCommitments responses: '200': description: A successful response. schema: type: object properties: - seq: - type: string - format: uint64 + commitments: + type: array + items: + type: string default: description: An unexpected error response schema: @@ -29994,22 +30032,30 @@ paths: value: type: string format: byte + parameters: + - name: seq + description: the sequence number of the bridge request + in: path + required: true + type: string + format: uint64 tags: - Query - /lbm/fbridge/v1/operators: + /lbm/fbridge/v1/receiving/greatest_confirmed_seq: get: - summary: Operators queries a list of Operators registered on the bridge - operationId: FBridgeOperators + summary: >- + GreatestConsecutiveConfirmedSeq queries a greatest consecutive sequence + number confirmed by n-of-m operators + operationId: GreatestConsecutiveConfirmedSeq responses: '200': description: A successful response. schema: type: object properties: - operators: - type: array - items: - type: string + seq: + type: string + format: uint64 default: description: An unexpected error response schema: @@ -30034,7 +30080,7 @@ paths: format: byte tags: - Query - '/lbm/fbridge/v1/operators/{operator}/needed_submission_seqs': + '/lbm/fbridge/v1/receiving/operators/{operator}/needed_submission_seqs': get: summary: >- NeededSubmissionSeqs queries a list of sequence numbers that need to be @@ -30095,7 +30141,7 @@ paths: format: uint64 tags: - Query - '/lbm/fbridge/v1/operators/{operator}/provision/{seq}': + '/lbm/fbridge/v1/receiving/operators/{operator}/provision/{seq}': get: summary: >- SubmittedProvision queries a provision submitted by a particular @@ -30185,7 +30231,7 @@ paths: format: uint64 tags: - Query - '/lbm/fbridge/v1/operators/{operator}/seq': + '/lbm/fbridge/v1/receiving/operators/{operator}/seq': get: summary: >- GreatestSeqByOperator queries a greatest sequence number confirmed by a @@ -30230,90 +30276,7 @@ paths: type: string tags: - Query - /lbm/fbridge/v1/params: - get: - summary: Params queries the parameters of x/fbridge module. - operationId: FBridgeParams - responses: - '200': - description: A successful response. - schema: - type: object - properties: - params: - type: object - properties: - operator_trust_level: - description: >- - ratio of how many operators' confirmations are needed to - be valid. - type: object - properties: - numerator: - type: string - format: uint64 - denominator: - type: string - format: uint64 - guardian_trust_level: - description: >- - ratio of how many guardians' confirmations are needed to - be valid. - type: object - properties: - numerator: - type: string - format: uint64 - denominator: - type: string - format: uint64 - judge_trust_level: - description: >- - ratio of how many judges' confirmations are needed to be - valid. - type: object - properties: - numerator: - type: string - format: uint64 - denominator: - type: string - format: uint64 - timelock_period: - type: string - format: uint64 - title: >- - default timelock period for each provision (unix - timestamp) - proposal_period: - type: string - format: uint64 - title: default period of the proposal to update the role - default: - description: An unexpected error response - schema: - type: object - properties: - error: - type: string - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - type_url: - type: string - value: - type: string - format: byte - tags: - - Query - '/lbm/fbridge/v1/provision/{seq}': + '/lbm/fbridge/v1/receiving/provision/{seq}': get: summary: ConfirmedProvision queries a particular sequence of confirmed provisions operationId: ConfirmedProvision @@ -30606,6 +30569,94 @@ paths: type: string tags: - Query + /lbm/fbridge/v1/sending/blocknums: + get: + summary: >- + BlocknumToSeqs queries a list of block numbers for which each sequence + has been confirmed. + operationId: SeqToBlocknums + responses: + '200': + description: A successful response. + schema: + type: object + properties: + blocknums: + type: array + items: + type: string + format: uint64 + default: + description: An unexpected error response + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + parameters: + - name: seqs + description: list of sequence number of the bridge request. + in: query + required: false + type: array + items: + type: string + format: uint64 + collectionFormat: multi + tags: + - Query + /lbm/fbridge/v1/sending/nextseq: + get: + summary: NextSeqSend queries the sequence of next bridge request + operationId: NextSeqSend + responses: + '200': + description: A successful response. + schema: + type: object + properties: + seq: + type: string + format: uint64 + default: + description: An unexpected error response + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + tags: + - Query definitions: cosmos.auth.v1beta1.Params: type: object @@ -50455,6 +50506,14 @@ definitions: type: string format: uint64 title: the unix timestamp the proposal will be expired (unix timestamp) + lbm.fbridge.v1.QuerySeqToBlocknumsResponse: + type: object + properties: + blocknums: + type: array + items: + type: string + format: uint64 lbm.fbridge.v1.QuerySubmittedProvisionResponse: type: object properties: diff --git a/docs/core/proto-docs.md b/docs/core/proto-docs.md index 8982d795db..736b4ac62b 100644 --- a/docs/core/proto-docs.md +++ b/docs/core/proto-docs.md @@ -804,6 +804,8 @@ - [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) @@ -12079,6 +12081,36 @@ GenesisState defines the fbridge module's genesis state. + + +### QuerySeqToBlocknumsRequest + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `seqs` | [uint64](#uint64) | repeated | list of sequence number of the bridge request | + + + + + + + + +### QuerySeqToBlocknumsResponse + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `blocknums` | [uint64](#uint64) | repeated | | + + + + + + ### QuerySubmittedProvisionRequest @@ -12125,13 +12157,14 @@ GenesisState defines the fbridge module's genesis state. | 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/nextseq_send| -| `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/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/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/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/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/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/commitments/{seq}| +| `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| diff --git a/proto/lbm/fbridge/v1/fbridge.proto b/proto/lbm/fbridge/v1/fbridge.proto index 6db9506e53..fccbf79a22 100644 --- a/proto/lbm/fbridge/v1/fbridge.proto +++ b/proto/lbm/fbridge/v1/fbridge.proto @@ -72,4 +72,4 @@ message RoleProposal { // the unix timestamp the proposal will be expired (unix timestamp) uint64 expired_at = 5; -} \ No newline at end of file +} diff --git a/proto/lbm/fbridge/v1/genesis.proto b/proto/lbm/fbridge/v1/genesis.proto index 087d1acca9..35775047b2 100644 --- a/proto/lbm/fbridge/v1/genesis.proto +++ b/proto/lbm/fbridge/v1/genesis.proto @@ -22,7 +22,7 @@ message SendingState { // 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; + repeated BlockSeqInfo seq_to_blocknum = 2 [(gogoproto.nullable) = false]; } message BlockSeqInfo { diff --git a/proto/lbm/fbridge/v1/query.proto b/proto/lbm/fbridge/v1/query.proto index 900aac4e8b..120039df88 100644 --- a/proto/lbm/fbridge/v1/query.proto +++ b/proto/lbm/fbridge/v1/query.proto @@ -16,28 +16,33 @@ service Query { // NextSeqSend queries the sequence of next bridge request rpc NextSeqSend(QueryNextSeqSendRequest) returns (QueryNextSeqSendResponse) { - option (google.api.http).get = "/lbm/fbridge/v1/nextseq_send"; + 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/operators/{operator}/seq"; + 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/greatest_confirmed_seq"; + 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/operators/{operator}/provision/{seq}"; + 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/provision/{seq}"; + 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 @@ -45,12 +50,12 @@ service Query { // 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/operators/{operator}/needed_submission_seqs"; + 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/commitments/{seq}"; + option (google.api.http).get = "/lbm/fbridge/v1/receiving/commitments/{seq}"; } // Guardians queries a list of Guardians registered on the bridge @@ -91,6 +96,15 @@ 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; @@ -182,4 +196,4 @@ message QueryProposalRequest { message QueryProposalResponse { RoleProposal proposal = 1; -} \ No newline at end of file +} diff --git a/x/fbridge/client/cli/query.go b/x/fbridge/client/cli/query.go index 10cd8c5588..4878af22e7 100644 --- a/x/fbridge/client/cli/query.go +++ b/x/fbridge/client/cli/query.go @@ -1,13 +1,20 @@ 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{ @@ -17,6 +24,7 @@ func NewQueryCmd() *cobra.Command { cmd.AddCommand( NewQueryNextSeqSendCmd(), + NewQuerySeqToBlocknumsCmd(), ) return cmd @@ -24,7 +32,7 @@ func NewQueryCmd() *cobra.Command { func NewQueryNextSeqSendCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "nextseq-send", + Use: "sending-next-seq", Short: "Query the next sequence number for sending", Args: cobra.NoArgs, RunE: func(cmd *cobra.Command, args []string) error { @@ -45,3 +53,40 @@ func NewQueryNextSeqSendCmd() *cobra.Command { 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/keeper/genesis.go b/x/fbridge/keeper/genesis.go index a0b492207e..9312e18a97 100644 --- a/x/fbridge/keeper/genesis.go +++ b/x/fbridge/keeper/genesis.go @@ -1,12 +1,17 @@ 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 } @@ -14,7 +19,24 @@ func (k Keeper) InitGenesis(ctx sdk.Context, gs *types.GenesisState) error { func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { return &types.GenesisState{ SendingState: types.SendingState{ - NextSeq: k.GetNextSequence(ctx), + 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 index 4953a0a5ef..e2460064c2 100644 --- a/x/fbridge/keeper/grpc_query.go +++ b/x/fbridge/keeper/grpc_query.go @@ -2,6 +2,7 @@ package keeper import ( "context" + "fmt" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -27,6 +28,30 @@ func (k Keeper) NextSeqSend(goCtx context.Context, req *types.QueryNextSeqSendRe 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") } diff --git a/x/fbridge/keeper/transfer.go b/x/fbridge/keeper/transfer.go index c1c1f65b6f..8e63588366 100644 --- a/x/fbridge/keeper/transfer.go +++ b/x/fbridge/keeper/transfer.go @@ -32,10 +32,28 @@ func (k Keeper) handleBridgeTransfer(ctx sdk.Context, sender sdk.AccAddress, amo 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) diff --git a/x/fbridge/keeper/transfer_test.go b/x/fbridge/keeper/transfer_test.go index b0bdc05849..ac0743ad98 100644 --- a/x/fbridge/keeper/transfer_test.go +++ b/x/fbridge/keeper/transfer_test.go @@ -37,6 +37,9 @@ func TestHandleBridgeTransfer(t *testing.T) { 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) { diff --git a/x/fbridge/types/genesis.pb.go b/x/fbridge/types/genesis.pb.go index 60dc09d4c7..7b28e12f13 100644 --- a/x/fbridge/types/genesis.pb.go +++ b/x/fbridge/types/genesis.pb.go @@ -91,7 +91,7 @@ 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,omitempty"` + SeqToBlocknum []BlockSeqInfo `protobuf:"bytes,2,rep,name=seq_to_blocknum,json=seqToBlocknum,proto3" json:"seq_to_blocknum"` } func (m *SendingState) Reset() { *m = SendingState{} } @@ -475,49 +475,49 @@ func init() { func init() { proto.RegisterFile("lbm/fbridge/v1/genesis.proto", fileDescriptor_0fc3cc4535a29f6d) } var fileDescriptor_0fc3cc4535a29f6d = []byte{ - // 665 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x94, 0x4d, 0x6f, 0xd3, 0x4c, - 0x10, 0xc7, 0xe3, 0xc4, 0x4a, 0xdb, 0x69, 0xfa, 0xa2, 0xd5, 0xf3, 0x54, 0x6e, 0x28, 0x4e, 0x64, - 0x71, 0xe8, 0x01, 0x62, 0x0a, 0x48, 0xbc, 0xa8, 0x12, 0x52, 0x5a, 0xb5, 0x02, 0x09, 0x81, 0x6c, - 0x0e, 0xa8, 0x17, 0xcb, 0x76, 0x36, 0xee, 0xaa, 0xb1, 0xd7, 0xf6, 0x6e, 0xa2, 0xf6, 0x1b, 0x70, - 0xe4, 0xc6, 0x95, 0x0b, 0xdf, 0xa5, 0xc7, 0x1e, 0x39, 0x20, 0x84, 0xda, 0x2f, 0x82, 0xbc, 0x5d, - 0xbf, 0xc4, 0x6d, 0x25, 0xb8, 0xed, 0xee, 0xfc, 0xe7, 0x37, 0xff, 0x59, 0x8f, 0x17, 0xb6, 0x26, - 0x5e, 0x68, 0x8e, 0xbd, 0x94, 0x8c, 0x02, 0x6c, 0xce, 0x76, 0xcc, 0x00, 0x47, 0x98, 0x11, 0x36, - 0x88, 0x53, 0xca, 0x29, 0x5a, 0x9d, 0x78, 0xe1, 0x40, 0x46, 0x07, 0xb3, 0x9d, 0xee, 0x7f, 0x01, - 0x0d, 0xa8, 0x08, 0x99, 0xd9, 0xea, 0x5a, 0xd5, 0xad, 0x33, 0xf2, 0x04, 0x11, 0x35, 0x7e, 0x2a, - 0xd0, 0x39, 0xbc, 0xa6, 0xda, 0xdc, 0xe5, 0x18, 0x3d, 0x83, 0x76, 0xec, 0xa6, 0x6e, 0xc8, 0x34, - 0xa5, 0xaf, 0x6c, 0x2f, 0x3f, 0xd9, 0x18, 0xcc, 0x57, 0x19, 0x7c, 0x10, 0xd1, 0xa1, 0x7a, 0xfe, - 0xab, 0xd7, 0xb0, 0xa4, 0x16, 0x1d, 0xc2, 0x0a, 0xc3, 0xd1, 0x88, 0x44, 0x81, 0xc3, 0x32, 0x8c, - 0xd6, 0x14, 0xc9, 0x5b, 0xf5, 0x64, 0xfb, 0x5a, 0x24, 0x4a, 0x49, 0x44, 0x87, 0x55, 0xce, 0xd0, - 0x3b, 0x58, 0x4b, 0xb1, 0x8f, 0xc9, 0xac, 0x44, 0xb5, 0x04, 0x4a, 0xaf, 0xa3, 0xac, 0x5c, 0x56, - 0x85, 0xad, 0xa6, 0x73, 0xa7, 0xc6, 0x14, 0x3a, 0xd5, 0x92, 0x68, 0x13, 0x16, 0x23, 0x7c, 0xca, - 0x1d, 0x86, 0x13, 0xd1, 0x9f, 0x6a, 0x2d, 0x64, 0x7b, 0x1b, 0x27, 0x68, 0x1f, 0xd6, 0x18, 0x4e, - 0x1c, 0x4e, 0x1d, 0x6f, 0x42, 0xfd, 0x93, 0x68, 0x1a, 0x6a, 0xcd, 0x7e, 0xeb, 0xb6, 0x26, 0x86, - 0x59, 0xdc, 0xc6, 0xc9, 0x9b, 0x68, 0x4c, 0xad, 0x15, 0x86, 0x93, 0x8f, 0x74, 0x28, 0x53, 0x5e, - 0xa9, 0x9f, 0xbf, 0xf5, 0x1a, 0xc6, 0x2e, 0x74, 0xaa, 0x22, 0xb4, 0x0e, 0xad, 0xb2, 0x62, 0xb6, - 0x44, 0x5d, 0x58, 0xac, 0x94, 0xc9, 0x8e, 0x8b, 0xbd, 0xf1, 0x5d, 0x85, 0xd5, 0xf9, 0xee, 0x10, - 0x85, 0x07, 0x41, 0x8a, 0x5d, 0x8e, 0x19, 0x77, 0x7c, 0x1a, 0x31, 0xec, 0x4f, 0x39, 0x99, 0xe1, - 0xac, 0x0f, 0xc7, 0x3b, 0x73, 0x68, 0x8c, 0x53, 0x97, 0xd3, 0x54, 0x53, 0x84, 0xe3, 0x5e, 0xdd, - 0xf1, 0x7b, 0x19, 0xcf, 0x4d, 0xf7, 0x73, 0xd8, 0x5e, 0xc9, 0xb2, 0x71, 0x32, 0x3c, 0xcb, 0x85, - 0xe8, 0x13, 0x68, 0x45, 0xc1, 0x7a, 0x91, 0xe6, 0xdf, 0x15, 0xf9, 0x3f, 0x07, 0xcc, 0x93, 0x5f, - 0x54, 0xc8, 0xb5, 0x56, 0xc4, 0xa7, 0x56, 0xad, 0x8d, 0xdb, 0xdd, 0xa1, 0x87, 0x80, 0x62, 0x39, - 0x64, 0xfe, 0xc4, 0x25, 0x61, 0x96, 0xc2, 0x34, 0xb5, 0xdf, 0xda, 0x56, 0xad, 0x75, 0x19, 0xd9, - 0xcb, 0x02, 0x36, 0x4e, 0x18, 0xda, 0x85, 0x65, 0x9f, 0x86, 0x21, 0xe1, 0x21, 0x8e, 0x38, 0xd3, - 0xda, 0xc2, 0x74, 0xb7, 0x6e, 0x7a, 0xaf, 0x90, 0x58, 0x55, 0x39, 0x7a, 0x09, 0x10, 0xa7, 0x74, - 0x46, 0x18, 0xa1, 0x11, 0xd3, 0x16, 0x44, 0xf2, 0xe6, 0x8d, 0x5f, 0x21, 0x57, 0x58, 0x15, 0x31, - 0x72, 0xe1, 0x9e, 0x4f, 0xa3, 0x31, 0x49, 0x43, 0x3c, 0x72, 0xe4, 0x48, 0x95, 0x68, 0x6d, 0x51, - 0xb0, 0x8c, 0x9b, 0x46, 0x64, 0x4a, 0x09, 0xd5, 0x0a, 0x8c, 0x9d, 0xcd, 0x58, 0x69, 0x55, 0x4e, - 0xd9, 0x6b, 0x58, 0xab, 0xdd, 0x79, 0x36, 0x56, 0x95, 0x59, 0x50, 0xb6, 0x97, 0xac, 0x62, 0x9f, - 0x0f, 0x61, 0xb3, 0x18, 0x42, 0xe3, 0x08, 0xa0, 0x84, 0xfe, 0x5b, 0x2e, 0xd2, 0x01, 0x2a, 0x4d, - 0xb5, 0x84, 0xbe, 0x72, 0x62, 0x7c, 0x55, 0x60, 0xa9, 0x68, 0xa5, 0xa6, 0x56, 0xea, 0x6a, 0xb4, - 0x03, 0xea, 0xc8, 0xe5, 0xae, 0x7c, 0x36, 0xee, 0xdf, 0x79, 0xd1, 0xfb, 0x2e, 0x77, 0x2d, 0x21, - 0x45, 0xcf, 0xa1, 0x9d, 0xbd, 0x0f, 0x53, 0x26, 0x1f, 0x88, 0xde, 0x9d, 0x49, 0xb6, 0x90, 0x59, - 0x52, 0x6e, 0x1c, 0x00, 0xba, 0x79, 0xd9, 0xb7, 0xfc, 0xa2, 0xf3, 0x9e, 0x9b, 0x75, 0xcf, 0xc3, - 0xb7, 0xe7, 0x97, 0xba, 0x72, 0x71, 0xa9, 0x2b, 0xbf, 0x2f, 0x75, 0xe5, 0xcb, 0x95, 0xde, 0xb8, - 0xb8, 0xd2, 0x1b, 0x3f, 0xae, 0xf4, 0xc6, 0xd1, 0xe3, 0x80, 0xf0, 0xe3, 0xa9, 0x37, 0xf0, 0x69, - 0x68, 0x1e, 0x90, 0x88, 0xf9, 0xc7, 0xc4, 0x35, 0xc7, 0x72, 0xf1, 0x88, 0x8d, 0x4e, 0xcc, 0xd3, - 0xe2, 0x45, 0xe6, 0x67, 0x31, 0x66, 0x5e, 0x5b, 0xbc, 0xc6, 0x4f, 0xff, 0x04, 0x00, 0x00, 0xff, - 0xff, 0x4e, 0x85, 0xc3, 0xf2, 0xf1, 0x05, 0x00, 0x00, + // 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) { @@ -1343,7 +1343,7 @@ func (m *SendingState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.SeqToBlocknum = append(m.SeqToBlocknum, &BlockSeqInfo{}) + m.SeqToBlocknum = append(m.SeqToBlocknum, BlockSeqInfo{}) if err := m.SeqToBlocknum[len(m.SeqToBlocknum)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } diff --git a/x/fbridge/types/keys.go b/x/fbridge/types/keys.go index 03179de065..714c3b4fcf 100644 --- a/x/fbridge/types/keys.go +++ b/x/fbridge/types/keys.go @@ -1,5 +1,7 @@ package types +import "encoding/binary" + const ( // ModuleName is the module name constant used in many places ModuleName = "fbridge" @@ -9,6 +11,13 @@ const ( ) var ( - KeyParams = []byte{0x01} // key for fbridge module params - KeyNextSeqSend = []byte{0x02} // key for the next bridge send sequence + 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/query.pb.go b/x/fbridge/types/query.pb.go index d43ba5168b..7583ca187f 100644 --- a/x/fbridge/types/query.pb.go +++ b/x/fbridge/types/query.pb.go @@ -190,6 +190,95 @@ func (m *QueryNextSeqSendResponse) GetSeq() uint64 { 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"` @@ -199,7 +288,7 @@ func (m *QueryGreatestSeqByOperatorRequest) Reset() { *m = QueryGreatest func (m *QueryGreatestSeqByOperatorRequest) String() string { return proto.CompactTextString(m) } func (*QueryGreatestSeqByOperatorRequest) ProtoMessage() {} func (*QueryGreatestSeqByOperatorRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_5e7780f9db9d346e, []int{4} + return fileDescriptor_5e7780f9db9d346e, []int{6} } func (m *QueryGreatestSeqByOperatorRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -243,7 +332,7 @@ func (m *QueryGreatestSeqByOperatorResponse) Reset() { *m = QueryGreates func (m *QueryGreatestSeqByOperatorResponse) String() string { return proto.CompactTextString(m) } func (*QueryGreatestSeqByOperatorResponse) ProtoMessage() {} func (*QueryGreatestSeqByOperatorResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_5e7780f9db9d346e, []int{5} + return fileDescriptor_5e7780f9db9d346e, []int{7} } func (m *QueryGreatestSeqByOperatorResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -290,7 +379,7 @@ func (m *QueryGreatestConsecutiveConfirmedSeqRequest) String() string { } func (*QueryGreatestConsecutiveConfirmedSeqRequest) ProtoMessage() {} func (*QueryGreatestConsecutiveConfirmedSeqRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_5e7780f9db9d346e, []int{6} + return fileDescriptor_5e7780f9db9d346e, []int{8} } func (m *QueryGreatestConsecutiveConfirmedSeqRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -331,7 +420,7 @@ func (m *QueryGreatestConsecutiveConfirmedSeqResponse) String() string { } func (*QueryGreatestConsecutiveConfirmedSeqResponse) ProtoMessage() {} func (*QueryGreatestConsecutiveConfirmedSeqResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_5e7780f9db9d346e, []int{7} + return fileDescriptor_5e7780f9db9d346e, []int{9} } func (m *QueryGreatestConsecutiveConfirmedSeqResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -378,7 +467,7 @@ func (m *QuerySubmittedProvisionRequest) Reset() { *m = QuerySubmittedPr func (m *QuerySubmittedProvisionRequest) String() string { return proto.CompactTextString(m) } func (*QuerySubmittedProvisionRequest) ProtoMessage() {} func (*QuerySubmittedProvisionRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_5e7780f9db9d346e, []int{8} + return fileDescriptor_5e7780f9db9d346e, []int{10} } func (m *QuerySubmittedProvisionRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -430,7 +519,7 @@ func (m *QuerySubmittedProvisionResponse) Reset() { *m = QuerySubmittedP func (m *QuerySubmittedProvisionResponse) String() string { return proto.CompactTextString(m) } func (*QuerySubmittedProvisionResponse) ProtoMessage() {} func (*QuerySubmittedProvisionResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_5e7780f9db9d346e, []int{9} + return fileDescriptor_5e7780f9db9d346e, []int{11} } func (m *QuerySubmittedProvisionResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -484,7 +573,7 @@ func (m *QueryNeededSubmissionSeqsRequest) Reset() { *m = QueryNeededSub func (m *QueryNeededSubmissionSeqsRequest) String() string { return proto.CompactTextString(m) } func (*QueryNeededSubmissionSeqsRequest) ProtoMessage() {} func (*QueryNeededSubmissionSeqsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_5e7780f9db9d346e, []int{10} + return fileDescriptor_5e7780f9db9d346e, []int{12} } func (m *QueryNeededSubmissionSeqsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -535,7 +624,7 @@ func (m *QueryNeededSubmissionSeqsResponse) Reset() { *m = QueryNeededSu func (m *QueryNeededSubmissionSeqsResponse) String() string { return proto.CompactTextString(m) } func (*QueryNeededSubmissionSeqsResponse) ProtoMessage() {} func (*QueryNeededSubmissionSeqsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_5e7780f9db9d346e, []int{11} + return fileDescriptor_5e7780f9db9d346e, []int{13} } func (m *QueryNeededSubmissionSeqsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -580,7 +669,7 @@ func (m *QueryConfirmedProvisionRequest) Reset() { *m = QueryConfirmedPr func (m *QueryConfirmedProvisionRequest) String() string { return proto.CompactTextString(m) } func (*QueryConfirmedProvisionRequest) ProtoMessage() {} func (*QueryConfirmedProvisionRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_5e7780f9db9d346e, []int{12} + return fileDescriptor_5e7780f9db9d346e, []int{14} } func (m *QueryConfirmedProvisionRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -625,7 +714,7 @@ func (m *QueryConfirmedProvisionResponse) Reset() { *m = QueryConfirmedP func (m *QueryConfirmedProvisionResponse) String() string { return proto.CompactTextString(m) } func (*QueryConfirmedProvisionResponse) ProtoMessage() {} func (*QueryConfirmedProvisionResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_5e7780f9db9d346e, []int{13} + return fileDescriptor_5e7780f9db9d346e, []int{15} } func (m *QueryConfirmedProvisionResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -677,7 +766,7 @@ 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{14} + return fileDescriptor_5e7780f9db9d346e, []int{16} } func (m *QueryCommitmentsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -721,7 +810,7 @@ func (m *QueryCommitmentsResponse) Reset() { *m = QueryCommitmentsRespon func (m *QueryCommitmentsResponse) String() string { return proto.CompactTextString(m) } func (*QueryCommitmentsResponse) ProtoMessage() {} func (*QueryCommitmentsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_5e7780f9db9d346e, []int{15} + return fileDescriptor_5e7780f9db9d346e, []int{17} } func (m *QueryCommitmentsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -764,7 +853,7 @@ 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{16} + return fileDescriptor_5e7780f9db9d346e, []int{18} } func (m *QueryGuardiansRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -801,7 +890,7 @@ 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{17} + return fileDescriptor_5e7780f9db9d346e, []int{19} } func (m *QueryGuardiansResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -844,7 +933,7 @@ 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{18} + return fileDescriptor_5e7780f9db9d346e, []int{20} } func (m *QueryOperatorsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -881,7 +970,7 @@ 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{19} + return fileDescriptor_5e7780f9db9d346e, []int{21} } func (m *QueryOperatorsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -924,7 +1013,7 @@ 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{20} + return fileDescriptor_5e7780f9db9d346e, []int{22} } func (m *QueryJudgesRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -961,7 +1050,7 @@ 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{21} + return fileDescriptor_5e7780f9db9d346e, []int{23} } func (m *QueryJudgesResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1006,7 +1095,7 @@ 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{22} + return fileDescriptor_5e7780f9db9d346e, []int{24} } func (m *QueryProposalsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1050,7 +1139,7 @@ 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{23} + return fileDescriptor_5e7780f9db9d346e, []int{25} } func (m *QueryProposalsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1095,7 +1184,7 @@ 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{24} + return fileDescriptor_5e7780f9db9d346e, []int{26} } func (m *QueryProposalRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1139,7 +1228,7 @@ 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{25} + return fileDescriptor_5e7780f9db9d346e, []int{27} } func (m *QueryProposalResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1180,6 +1269,8 @@ func init() { 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") @@ -1207,79 +1298,84 @@ func init() { func init() { proto.RegisterFile("lbm/fbridge/v1/query.proto", fileDescriptor_5e7780f9db9d346e) } var fileDescriptor_5e7780f9db9d346e = []byte{ - // 1152 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x57, 0xcf, 0x6f, 0x1b, 0x45, - 0x14, 0xce, 0xb6, 0x69, 0x14, 0x3f, 0x4b, 0x80, 0x86, 0x34, 0x4d, 0x4d, 0xb0, 0x93, 0x6d, 0x9b, - 0x86, 0x36, 0xd9, 0x8d, 0x4d, 0x94, 0x20, 0x9a, 0x0a, 0x94, 0xa0, 0x22, 0x8a, 0x54, 0x52, 0xa7, - 0x27, 0x2e, 0xd6, 0xda, 0x3b, 0xd9, 0x2e, 0xd8, 0x3b, 0xde, 0x9d, 0x75, 0x94, 0x28, 0xca, 0xa5, - 0x07, 0x2e, 0x08, 0x09, 0x89, 0x13, 0x17, 0xfe, 0x06, 0xa4, 0xfe, 0x03, 0x1c, 0x7b, 0xe0, 0x50, - 0x89, 0x0b, 0x27, 0x84, 0x12, 0xfe, 0x10, 0xb4, 0xb3, 0x6f, 0xc6, 0xf6, 0xae, 0xc7, 0x71, 0xb9, - 0x70, 0x9b, 0x7d, 0xf3, 0xbe, 0xef, 0x7d, 0x6f, 0x7e, 0x7d, 0x36, 0x94, 0xda, 0xcd, 0x8e, 0x7d, - 0xd8, 0x8c, 0x7c, 0xd7, 0xa3, 0xf6, 0x51, 0xd5, 0x0e, 0x7b, 0x34, 0x3a, 0xb1, 0xba, 0x11, 0x8b, - 0x19, 0x79, 0xab, 0xdd, 0xec, 0x58, 0x38, 0x67, 0x1d, 0x55, 0x4b, 0x8b, 0x1e, 0x63, 0x5e, 0x9b, - 0xda, 0x4e, 0xd7, 0xb7, 0x9d, 0x20, 0x60, 0xb1, 0x13, 0xfb, 0x2c, 0xe0, 0x69, 0x76, 0x69, 0xce, - 0x63, 0x1e, 0x13, 0x43, 0x3b, 0x19, 0x61, 0xf4, 0x5e, 0x8b, 0xf1, 0x0e, 0xe3, 0x76, 0xd3, 0xe1, - 0x34, 0x25, 0xb7, 0x8f, 0xaa, 0x4d, 0x1a, 0x3b, 0x55, 0xbb, 0xeb, 0x78, 0x7e, 0x20, 0x28, 0x30, - 0x77, 0x31, 0xa3, 0x45, 0x96, 0x16, 0xb3, 0xe6, 0x1c, 0x90, 0xa7, 0x09, 0x7e, 0xdf, 0x89, 0x9c, - 0x0e, 0xaf, 0xd3, 0xb0, 0x47, 0x79, 0x6c, 0x7e, 0x09, 0xef, 0x0e, 0x45, 0x79, 0x97, 0x05, 0x9c, - 0x92, 0x4d, 0x98, 0xe9, 0x8a, 0xc8, 0x82, 0xb1, 0x64, 0xac, 0x16, 0x6b, 0xf3, 0xd6, 0x70, 0x2f, - 0x56, 0x9a, 0xbf, 0x3b, 0xfd, 0xea, 0xaf, 0xca, 0x54, 0x1d, 0x73, 0xcd, 0x9b, 0x70, 0x43, 0x90, - 0x3d, 0xa1, 0xc7, 0xf1, 0x01, 0x0d, 0x0f, 0x68, 0xe0, 0xca, 0x3a, 0x6b, 0xb0, 0x90, 0x9f, 0xc2, - 0x62, 0xef, 0xc0, 0x55, 0x4e, 0x43, 0x51, 0x69, 0xba, 0x9e, 0x0c, 0xcd, 0x4f, 0x60, 0x59, 0x64, - 0x7f, 0x1e, 0x51, 0x27, 0xa6, 0x3c, 0x41, 0xec, 0x9e, 0x7c, 0xd5, 0xa5, 0x91, 0x13, 0xb3, 0x08, - 0x29, 0x49, 0x09, 0x66, 0x19, 0x86, 0x04, 0xb6, 0x50, 0x57, 0xdf, 0xe6, 0x16, 0x98, 0xe3, 0x08, - 0xb4, 0x85, 0xd7, 0xe1, 0xfe, 0x10, 0x6e, 0x2f, 0xc9, 0x6b, 0xf5, 0x62, 0xff, 0x88, 0xee, 0xb1, - 0xe0, 0xd0, 0x8f, 0x3a, 0xd4, 0x3d, 0xa0, 0xa1, 0xec, 0xea, 0x53, 0x58, 0x9b, 0x2c, 0x5d, 0x5b, - 0xf0, 0x09, 0x94, 0x05, 0xc3, 0x41, 0xaf, 0xd9, 0xf1, 0xe3, 0x98, 0xba, 0xfb, 0x11, 0x3b, 0xf2, - 0xb9, 0xcf, 0x82, 0x09, 0xda, 0x94, 0x7c, 0x57, 0xfa, 0x7c, 0x3f, 0x1b, 0x50, 0xd1, 0x12, 0xa2, - 0x8a, 0x6d, 0x98, 0x76, 0x9d, 0xd8, 0xc1, 0xad, 0x7d, 0x3f, 0xb7, 0xb5, 0x12, 0xf0, 0x99, 0x13, - 0x3b, 0xb8, 0xc3, 0x02, 0x40, 0x1e, 0xc2, 0x0c, 0x8f, 0x9d, 0xb8, 0xc7, 0x45, 0xc5, 0x62, 0xad, - 0xa2, 0x85, 0x1e, 0x88, 0x34, 0x79, 0x3c, 0x52, 0x90, 0xf9, 0x0c, 0x96, 0xf0, 0x0c, 0x50, 0x97, - 0xba, 0x42, 0x20, 0x17, 0xc9, 0x34, 0xe4, 0x93, 0x74, 0x3b, 0x07, 0xd7, 0x22, 0x27, 0xf0, 0x28, - 0xf6, 0x9b, 0x7e, 0x98, 0xdb, 0x78, 0x56, 0x46, 0xb3, 0x62, 0xcb, 0x04, 0xa6, 0x39, 0x0d, 0x93, - 0xd3, 0x7c, 0x75, 0x75, 0xba, 0x2e, 0xc6, 0x66, 0x0d, 0x97, 0x5e, 0xed, 0x54, 0x6e, 0xe9, 0xf3, - 0xdb, 0xa5, 0x96, 0x77, 0x14, 0xe8, 0x7f, 0x5e, 0xde, 0xfb, 0x78, 0xfb, 0xf6, 0x58, 0xa7, 0xe3, - 0xc7, 0x1d, 0x1a, 0xc4, 0x5c, 0xdf, 0xc8, 0x0e, 0xde, 0xc7, 0xa1, 0x64, 0x6c, 0x60, 0x09, 0x8a, - 0xad, 0x7e, 0x58, 0xac, 0x59, 0xa1, 0x3e, 0x18, 0x32, 0x6f, 0xc0, 0xf5, 0xf4, 0xdc, 0xf7, 0x9c, - 0xc8, 0xf5, 0x9d, 0x40, 0x3d, 0x27, 0x5b, 0x30, 0x9f, 0x9d, 0x40, 0xd2, 0x45, 0x28, 0x78, 0x32, - 0x88, 0x94, 0xfd, 0x80, 0x22, 0x94, 0x57, 0x34, 0x47, 0x38, 0x30, 0xd1, 0x27, 0x94, 0x27, 0x43, - 0x11, 0xaa, 0x80, 0x7a, 0xed, 0x1e, 0xf7, 0x5c, 0x8f, 0x2a, 0xb6, 0x75, 0x7c, 0xed, 0x64, 0x14, - 0xa9, 0xe6, 0x61, 0xe6, 0x1b, 0x11, 0x41, 0x1e, 0xfc, 0x32, 0x1b, 0xa8, 0x6a, 0x3f, 0x62, 0x5d, - 0xc6, 0x9d, 0xb6, 0x5a, 0xcf, 0x47, 0x00, 0xfd, 0xd7, 0x17, 0x37, 0x7a, 0xc5, 0x4a, 0x9f, 0x6a, - 0x2b, 0x79, 0xaa, 0xad, 0xd4, 0x07, 0xf0, 0xa9, 0xb6, 0xf6, 0x1d, 0x8f, 0x22, 0xb6, 0x3e, 0x80, - 0x34, 0x9f, 0x61, 0x77, 0x03, 0x05, 0x50, 0xd2, 0xc7, 0x50, 0xe8, 0xca, 0xa0, 0x50, 0x55, 0xac, - 0x2d, 0x66, 0x8f, 0x43, 0x9d, 0xb5, 0xa9, 0x44, 0xd6, 0xfb, 0xe9, 0xe6, 0x36, 0xcc, 0x0d, 0xb1, - 0x4a, 0xd5, 0x15, 0x28, 0xca, 0xa4, 0x86, 0xef, 0xe2, 0xf5, 0x02, 0x19, 0xfa, 0xc2, 0x35, 0x9f, - 0x66, 0xfa, 0x55, 0x6a, 0x3e, 0x82, 0x59, 0x99, 0x86, 0xdd, 0x8e, 0x17, 0xa3, 0xb2, 0x6b, 0x2f, - 0xdf, 0x86, 0x6b, 0x82, 0x93, 0x84, 0x30, 0x93, 0x9a, 0x06, 0x31, 0xb3, 0xd8, 0xbc, 0x2f, 0x95, - 0x6e, 0x8d, 0xcd, 0x49, 0x65, 0x99, 0xe5, 0x17, 0x7f, 0xfc, 0xf3, 0xd3, 0x95, 0x05, 0x32, 0x6f, - 0x67, 0x9c, 0x2f, 0xf5, 0x23, 0xf2, 0x9d, 0x01, 0xc5, 0x01, 0xc3, 0x21, 0x77, 0x47, 0x92, 0xe6, - 0xdd, 0xaa, 0xb4, 0x7a, 0x79, 0x22, 0x4a, 0xb8, 0x2d, 0x24, 0x94, 0xc9, 0x62, 0x56, 0x42, 0x40, - 0x8f, 0x63, 0x4e, 0xc3, 0x06, 0x4f, 0x0a, 0xff, 0x6a, 0xc0, 0xf5, 0x91, 0x56, 0x44, 0xaa, 0x23, - 0x2b, 0x8d, 0xf3, 0xbd, 0x52, 0xed, 0x4d, 0x20, 0x28, 0x73, 0x43, 0xc8, 0xbc, 0x47, 0x56, 0xb3, - 0x32, 0xd5, 0x8d, 0xb1, 0x4f, 0xe5, 0xf0, 0xcc, 0xe6, 0x34, 0x24, 0xbf, 0x1b, 0x50, 0xb9, 0xc4, - 0xd6, 0xc8, 0x83, 0xb1, 0x4a, 0xc6, 0x7b, 0x67, 0x69, 0xe7, 0xbf, 0x81, 0xb1, 0x21, 0x4b, 0x34, - 0xb4, 0x4a, 0x56, 0xb2, 0x0d, 0x79, 0x48, 0xd0, 0x68, 0x49, 0x58, 0x23, 0x69, 0xe7, 0xa5, 0x01, - 0x24, 0x6f, 0x89, 0xc4, 0x1a, 0x29, 0x42, 0x6b, 0xc6, 0x25, 0x7b, 0xe2, 0x7c, 0xd4, 0xb9, 0x23, - 0x74, 0x6e, 0x91, 0xcd, 0x89, 0x16, 0xbe, 0x2b, 0xf1, 0xf6, 0x29, 0xa7, 0xe1, 0x19, 0xf9, 0xc5, - 0x00, 0x92, 0x77, 0x1a, 0x8d, 0x6a, 0xad, 0x8f, 0x69, 0x54, 0xeb, 0x2d, 0xcc, 0xbc, 0x2b, 0x54, - 0x2f, 0x93, 0x4a, 0xee, 0x62, 0x65, 0x04, 0xfe, 0x66, 0xc0, 0xdc, 0x28, 0xe3, 0x25, 0x1b, 0x9a, - 0x1b, 0xa4, 0x75, 0xfe, 0x52, 0xf5, 0x0d, 0x10, 0x28, 0x73, 0x4f, 0xc8, 0x7c, 0x48, 0x1e, 0x4c, - 0xb4, 0xb8, 0x81, 0xa0, 0x6a, 0x70, 0xc5, 0x95, 0x1c, 0x0c, 0x4e, 0xbe, 0x37, 0xa0, 0x38, 0xe0, - 0x82, 0x9a, 0x47, 0x22, 0x6f, 0xaa, 0x9a, 0x47, 0x62, 0x84, 0xa1, 0x9a, 0x1f, 0x08, 0x9d, 0xb7, - 0xc8, 0x72, 0x56, 0xe7, 0x80, 0xa7, 0xe2, 0x82, 0x9e, 0x41, 0x41, 0x79, 0x27, 0xb9, 0x33, 0xfa, - 0x8a, 0x64, 0x4c, 0xb7, 0xb4, 0x72, 0x59, 0x1a, 0xca, 0x58, 0x16, 0x32, 0xde, 0x23, 0x37, 0x73, - 0x77, 0x46, 0x55, 0x3c, 0x83, 0x82, 0x72, 0x5a, 0x4d, 0xf9, 0xac, 0x45, 0x6b, 0xca, 0xe7, 0x0c, - 0x5b, 0x5f, 0x5e, 0xed, 0x56, 0xe2, 0x11, 0xa9, 0x35, 0x6b, 0x3c, 0x62, 0xc8, 0xcd, 0x35, 0x1e, - 0x31, 0xec, 0xed, 0x7a, 0x8f, 0x48, 0x3d, 0x9e, 0xbc, 0x30, 0xa0, 0xa0, 0xec, 0x57, 0xd3, 0x72, - 0xd6, 0xff, 0x35, 0x2d, 0xe7, 0x5c, 0xdc, 0x5c, 0x11, 0xc5, 0x97, 0x48, 0x39, 0x5b, 0x3c, 0x62, - 0x6d, 0x6a, 0x2b, 0xc7, 0x26, 0x3f, 0x18, 0x30, 0x2b, 0xd1, 0xe4, 0xf6, 0x58, 0x72, 0x29, 0xe1, - 0xce, 0x25, 0x59, 0xa8, 0x60, 0x53, 0x28, 0xb0, 0xc8, 0xda, 0x78, 0x05, 0xf6, 0xe9, 0xc0, 0x2f, - 0x83, 0xb3, 0xdd, 0xc7, 0xaf, 0xce, 0xcb, 0xc6, 0xeb, 0xf3, 0xb2, 0xf1, 0xf7, 0x79, 0xd9, 0xf8, - 0xf1, 0xa2, 0x3c, 0xf5, 0xfa, 0xa2, 0x3c, 0xf5, 0xe7, 0x45, 0x79, 0xea, 0xeb, 0x0d, 0xcf, 0x8f, - 0x9f, 0xf7, 0x9a, 0x56, 0x8b, 0x75, 0xec, 0x47, 0x7e, 0xc0, 0x5b, 0xcf, 0x7d, 0xc7, 0x3e, 0xc4, - 0xc1, 0x3a, 0x77, 0xbf, 0xb5, 0x8f, 0x55, 0x95, 0xf8, 0xa4, 0x4b, 0x79, 0x73, 0x46, 0xfc, 0xfd, - 0xfc, 0xf0, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x46, 0xe7, 0x3d, 0x95, 0x2a, 0x0f, 0x00, 0x00, + // 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. @@ -1298,6 +1394,8 @@ type QueryClient interface { 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 @@ -1351,6 +1449,15 @@ func (c *queryClient) NextSeqSend(ctx context.Context, in *QueryNextSeqSendReque 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...) @@ -1456,6 +1563,8 @@ type QueryServer interface { 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 @@ -1493,6 +1602,9 @@ func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsReq 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") } @@ -1567,6 +1679,24 @@ func _Query_NextSeqSend_Handler(srv interface{}, ctx context.Context, dec func(i 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 { @@ -1777,6 +1907,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "NextSeqSend", Handler: _Query_NextSeqSend_Handler, }, + { + MethodName: "SeqToBlocknums", + Handler: _Query_SeqToBlocknums_Handler, + }, { MethodName: "GreatestSeqByOperator", Handler: _Query_GreatestSeqByOperator_Handler, @@ -1933,6 +2067,88 @@ func (m *QueryNextSeqSendResponse) MarshalToSizedBuffer(dAtA []byte) (int, error 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) @@ -2176,20 +2392,20 @@ func (m *QueryNeededSubmissionSeqsResponse) MarshalToSizedBuffer(dAtA []byte) (i var l int _ = l if len(m.Seqs) > 0 { - dAtA5 := make([]byte, len(m.Seqs)*10) - var j4 int + dAtA9 := make([]byte, len(m.Seqs)*10) + var j8 int for _, num := range m.Seqs { for num >= 1<<7 { - dAtA5[j4] = uint8(uint64(num)&0x7f | 0x80) + dAtA9[j8] = uint8(uint64(num)&0x7f | 0x80) num >>= 7 - j4++ + j8++ } - dAtA5[j4] = uint8(num) - j4++ + dAtA9[j8] = uint8(num) + j8++ } - i -= j4 - copy(dAtA[i:], dAtA5[:j4]) - i = encodeVarintQuery(dAtA, i, uint64(j4)) + i -= j8 + copy(dAtA[i:], dAtA9[:j8]) + i = encodeVarintQuery(dAtA, i, uint64(j8)) i-- dAtA[i] = 0xa } @@ -2681,6 +2897,38 @@ func (m *QueryNextSeqSendResponse) Size() (n int) { 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 @@ -3224,6 +3472,258 @@ func (m *QueryNextSeqSendResponse) Unmarshal(dAtA []byte) error { } 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 diff --git a/x/fbridge/types/query.pb.gw.go b/x/fbridge/types/query.pb.gw.go index 8de3ab8ffe..c62ab4e113 100644 --- a/x/fbridge/types/query.pb.gw.go +++ b/x/fbridge/types/query.pb.gw.go @@ -67,6 +67,42 @@ func local_request_Query_NextSeqSend_0(ctx context.Context, marshaler runtime.Ma } +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 @@ -585,6 +621,26 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + 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() @@ -886,6 +942,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + 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() @@ -1112,19 +1188,21 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie 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}, []string{"lbm", "fbridge", "v1", "nextseq_send"}, "", 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, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"lbm", "fbridge", "v1", "operators", "operator", "seq"}, "", 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}, []string{"lbm", "fbridge", "v1", "greatest_confirmed_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, 1, 0, 4, 1, 5, 4, 2, 5, 1, 0, 4, 1, 5, 6}, []string{"lbm", "fbridge", "v1", "operators", "operator", "provision", "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, 1, 0, 4, 1, 5, 4}, []string{"lbm", "fbridge", "v1", "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, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"lbm", "fbridge", "v1", "operators", "operator", "needed_submission_seqs"}, "", 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, 1, 0, 4, 1, 5, 4}, []string{"lbm", "fbridge", "v1", "commitments", "seq"}, "", 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))) @@ -1142,6 +1220,8 @@ var ( forward_Query_NextSeqSend_0 = runtime.ForwardResponseMessage + forward_Query_SeqToBlocknums_0 = runtime.ForwardResponseMessage + forward_Query_GreatestSeqByOperator_0 = runtime.ForwardResponseMessage forward_Query_GreatestConsecutiveConfirmedSeq_0 = runtime.ForwardResponseMessage From 956d7a622e55569e5d65e6973feb7cda6f2c4819 Mon Sep 17 00:00:00 2001 From: 170210 <85928898+170210@users.noreply.github.com> Date: Fri, 3 May 2024 22:15:44 +0900 Subject: [PATCH 6/7] 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 --- CHANGELOG.md | 1 + docs/core/proto-docs.md | 164 +++- proto/lbm/fswap/v1/event.proto | 8 +- proto/lbm/fswap/v1/fswap.proto | 40 +- proto/lbm/fswap/v1/genesis.proto | 6 +- proto/lbm/fswap/v1/params.proto | 12 - proto/lbm/fswap/v1/query.proto | 39 +- proto/lbm/fswap/v1/tx.proto | 15 +- simapp/app.go | 15 +- x/ERRORS.md | 7 +- x/fswap/client/cli/query.go | 47 +- x/fswap/client/cli/tx.go | 190 +++- x/fswap/client/proposal_handler.go | 8 + x/fswap/codec/codec.go | 18 + x/fswap/handler.go | 29 +- x/fswap/keeper/calc.go | 7 + x/fswap/keeper/calc_test.go | 65 ++ x/fswap/keeper/expected_keepers.go | 19 + x/fswap/keeper/fswap.go | 30 - x/fswap/keeper/genesis.go | 52 +- x/fswap/keeper/genesis_test.go | 18 +- x/fswap/keeper/grpc_query.go | 65 +- x/fswap/keeper/grpc_query_params_test.go | 1 - x/fswap/keeper/keeper.go | 203 ++++- x/fswap/keeper/keeper_test.go | 176 +++- x/fswap/keeper/keys.go | 19 + x/fswap/keeper/msg_server.go | 59 +- x/fswap/keeper/msg_server_test.go | 134 +++ x/fswap/keeper/params.go | 35 - x/fswap/keeper/proposal.go | 163 ++++ x/fswap/keeper/proposal_test.go | 138 +++ x/fswap/keeper/query_params_test.go | 1 - x/fswap/module.go | 68 +- x/fswap/module_simulation.go | 5 +- x/fswap/proposal_handler_test.go | 40 + x/fswap/simulation/genesis.go | 64 -- x/fswap/simulation/genesis_test.go | 77 -- x/fswap/spec/README.md | 16 + x/fswap/testutil/expected_keepers_mocks.go | 152 ++-- x/fswap/types/codec.go | 36 +- x/fswap/types/config.go | 19 +- x/fswap/types/errors.go | 7 +- x/fswap/types/event.pb.go | 71 +- x/fswap/types/expected_keepers.go | 19 - x/fswap/types/fswap.go | 77 +- x/fswap/types/fswap.pb.go | 956 ++++++++++++++++++++- x/fswap/types/genesis.go | 42 +- x/fswap/types/genesis.pb.go | 144 +++- x/fswap/types/genesis_test.go | 68 +- x/fswap/types/keys.go | 12 - x/fswap/types/msgs.go | 67 +- x/fswap/types/params.go | 35 - x/fswap/types/params.pb.go | 317 ------- x/fswap/types/proposal.go | 54 ++ x/fswap/types/query.pb.go | 899 ++++++++++++++++--- x/fswap/types/query.pb.gw.go | 144 +++- x/fswap/types/tx.pb.go | 334 +++++-- x/fswap/types/types.go | 1 - 58 files changed, 4137 insertions(+), 1371 deletions(-) delete mode 100644 proto/lbm/fswap/v1/params.proto create mode 100644 x/fswap/client/proposal_handler.go create mode 100644 x/fswap/codec/codec.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 delete mode 100644 x/fswap/keeper/fswap.go delete mode 100644 x/fswap/keeper/grpc_query_params_test.go create mode 100644 x/fswap/keeper/keys.go delete mode 100644 x/fswap/keeper/params.go create mode 100644 x/fswap/keeper/proposal.go create mode 100644 x/fswap/keeper/proposal_test.go delete mode 100644 x/fswap/keeper/query_params_test.go create mode 100644 x/fswap/proposal_handler_test.go create mode 100644 x/fswap/spec/README.md delete mode 100644 x/fswap/types/expected_keepers.go delete mode 100644 x/fswap/types/params.go delete mode 100644 x/fswap/types/params.pb.go create mode 100644 x/fswap/types/proposal.go delete mode 100644 x/fswap/types/types.go diff --git a/CHANGELOG.md b/CHANGELOG.md index fdb019c12f..1e2c15134a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -45,6 +45,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (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 * (docs) [\#1120](https://github.com/Finschia/finschia-sdk/pull/1120) Update links in x/foundation README.md diff --git a/docs/core/proto-docs.md b/docs/core/proto-docs.md index 736b4ac62b..56d2cf5fd1 100644 --- a/docs/core/proto-docs.md +++ b/docs/core/proto-docs.md @@ -943,26 +943,28 @@ - [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/params.proto](#lbm/fswap/v1/params.proto) - - [Params](#lbm.fswap.v1.Params) - - [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) - - [QueryTotalSwappableAmountRequest](#lbm.fswap.v1.QueryTotalSwappableAmountRequest) - - [QueryTotalSwappableAmountResponse](#lbm.fswap.v1.QueryTotalSwappableAmountResponse) + - [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) - - [MsgSwapAllRequest](#lbm.fswap.v1.MsgSwapAllRequest) + - [MsgSwap](#lbm.fswap.v1.MsgSwap) + - [MsgSwapAll](#lbm.fswap.v1.MsgSwapAll) - [MsgSwapAllResponse](#lbm.fswap.v1.MsgSwapAllResponse) - - [MsgSwapRequest](#lbm.fswap.v1.MsgSwapRequest) - [MsgSwapResponse](#lbm.fswap.v1.MsgSwapResponse) - [Msg](#lbm.fswap.v1.Msg) @@ -13928,8 +13930,8 @@ Msg defines the foundation Msg service. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | `address` | [string](#string) | | holder's address | -| `old_coin` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | amount of the old currency | -| `new_coin` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | amount of the new currency | +| `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 | @@ -13952,47 +13954,67 @@ Msg defines the foundation Msg service. - + -### Swapped +### MakeSwapProposal +From cosmos-sdk 0.46.0 they deprecated this way, but currently finschia-sdk based on 0.45.10 + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `title` | [string](#string) | | | +| `description` | [string](#string) | | | +| `swap` | [Swap](#lbm.fswap.v1.Swap) | | | +| `to_denom_metadata` | [cosmos.bank.v1beta1.Metadata](#cosmos.bank.v1beta1.Metadata) | | | + + + + + + + + +### Swap | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `old_coin_amount` | [string](#string) | | | -| `new_coin_amount` | [string](#string) | | | +| `from_denom` | [string](#string) | | | +| `to_denom` | [string](#string) | | | +| `amount_cap_for_to_denom` | [string](#string) | | | +| `swap_rate` | [string](#string) | | | - - + - +### SwapStats - +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `swap_count` | [int32](#int32) | | | - -

Top

-## lbm/fswap/v1/params.proto - -### Params -Params defines the parameters for the module. + + +### Swapped + | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `swappable_new_coin_amount` | [string](#string) | | | +| `from_coin_amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +| `to_coin_amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | @@ -14023,8 +14045,9 @@ GenesisState defines the fswap module's genesis state. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `params` | [Params](#lbm.fswap.v1.Params) | | | -| `swapped` | [Swapped](#lbm.fswap.v1.Swapped) | | | +| `swaps` | [Swap](#lbm.fswap.v1.Swap) | repeated | | +| `swap_stats` | [SwapStats](#lbm.fswap.v1.SwapStats) | | | +| `swappeds` | [Swapped](#lbm.fswap.v1.Swapped) | repeated | | @@ -14053,6 +14076,12 @@ GenesisState defines the fswap module's genesis state. +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `fromDenom` | [string](#string) | | | +| `toDenom` | [string](#string) | | | + + @@ -14065,33 +14094,70 @@ GenesisState defines the fswap module's genesis state. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `old_coin` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | -| `new_coin` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +| `from_coin_amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +| `to_coin_amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | + + + + + + + + +### QuerySwapsRequest + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | | + + + + + + + + +### QuerySwapsResponse + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `swaps` | [Swap](#lbm.fswap.v1.Swap) | repeated | | +| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | | - + -### QueryTotalSwappableAmountRequest +### QueryTotalSwappableToCoinAmountRequest +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `fromDenom` | [string](#string) | | | +| `toDenom` | [string](#string) | | | + - -### QueryTotalSwappableAmountResponse + + +### QueryTotalSwappableToCoinAmountResponse | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `swappable_new_coin` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +| `swappable_amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | @@ -14111,8 +14177,9 @@ GenesisState defines the fswap module's genesis state. | Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | | ----------- | ------------ | ------------- | ------------| ------- | -------- | -| `Swapped` | [QuerySwappedRequest](#lbm.fswap.v1.QuerySwappedRequest) | [QuerySwappedResponse](#lbm.fswap.v1.QuerySwappedResponse) | | GET|/lbm/fswap/v1/swapped| -| `TotalNewCurrencySwapLimit` | [QueryTotalSwappableAmountRequest](#lbm.fswap.v1.QueryTotalSwappableAmountRequest) | [QueryTotalSwappableAmountResponse](#lbm.fswap.v1.QueryTotalSwappableAmountResponse) | | GET|/lbm/fswap/v1/swappable_new_coin_amount| +| `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| @@ -14125,41 +14192,44 @@ GenesisState defines the fswap module's genesis state. - + -### MsgSwapAllRequest +### MsgSwap | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | `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) | | | - + -### MsgSwapAllResponse +### MsgSwapAll +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `from_address` | [string](#string) | | holder's address | +| `from_denom` | [string](#string) | | | +| `to_denom` | [string](#string) | | | - -### MsgSwapRequest + +### MsgSwapAllResponse -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `from_address` | [string](#string) | | holder's address | -| `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | amount of old currency | @@ -14189,8 +14259,8 @@ GenesisState defines the fswap module's genesis state. | Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | | ----------- | ------------ | ------------- | ------------| ------- | -------- | -| `Swap` | [MsgSwapRequest](#lbm.fswap.v1.MsgSwapRequest) | [MsgSwapResponse](#lbm.fswap.v1.MsgSwapResponse) | | | -| `SwapAll` | [MsgSwapAllRequest](#lbm.fswap.v1.MsgSwapAllRequest) | [MsgSwapAllResponse](#lbm.fswap.v1.MsgSwapAllResponse) | | | +| `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/fswap/v1/event.proto b/proto/lbm/fswap/v1/event.proto index 2fea28e9d0..6834da7654 100644 --- a/proto/lbm/fswap/v1/event.proto +++ b/proto/lbm/fswap/v1/event.proto @@ -9,10 +9,10 @@ import "cosmos/base/v1beta1/coin.proto"; message EventSwapCoins { // holder's address string address = 1; - // amount of the old currency - cosmos.base.v1beta1.Coin old_coin = 2 + // from-coin amount + cosmos.base.v1beta1.Coin from_coin_amount = 2 [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/Finschia/finschia-sdk/types.Coin"]; - // amount of the new currency - cosmos.base.v1beta1.Coin new_coin = 3 + // 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 index 14315e32d0..13a5c2a006 100644 --- a/proto/lbm/fswap/v1/fswap.proto +++ b/proto/lbm/fswap/v1/fswap.proto @@ -4,9 +4,43 @@ 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 Swapped { +message Swap { + option (gogoproto.equal) = true; option (gogoproto.goproto_stringer) = false; - string old_coin_amount = 1 [(gogoproto.customtype) = "github.com/Finschia/finschia-sdk/types.Int", (gogoproto.nullable) = false]; - string new_coin_amount = 2 [(gogoproto.customtype) = "github.com/Finschia/finschia-sdk/types.Int", (gogoproto.nullable) = 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 index 43b639a341..c001741269 100644 --- a/proto/lbm/fswap/v1/genesis.proto +++ b/proto/lbm/fswap/v1/genesis.proto @@ -5,10 +5,10 @@ option go_package = "github.com/Finschia/finschia-sdk/x/fswap/types"; import "gogoproto/gogo.proto"; import "lbm/fswap/v1/fswap.proto"; -import "lbm/fswap/v1/params.proto"; // GenesisState defines the fswap module's genesis state. message GenesisState { - Params params = 1 [(gogoproto.nullable) = false]; - Swapped swapped = 2 [(gogoproto.nullable) = false]; + 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/params.proto b/proto/lbm/fswap/v1/params.proto deleted file mode 100644 index bc5535afb4..0000000000 --- a/proto/lbm/fswap/v1/params.proto +++ /dev/null @@ -1,12 +0,0 @@ -syntax = "proto3"; -package lbm.fswap.v1; - -option go_package = "github.com/Finschia/finschia-sdk/x/fswap/types"; - -import "gogoproto/gogo.proto"; - -// Params defines the parameters for the module. -message Params { - option (gogoproto.goproto_stringer) = false; - string swappable_new_coin_amount = 1 [(gogoproto.customtype) = "github.com/Finschia/finschia-sdk/types.Int", (gogoproto.nullable) = false]; -} \ No newline at end of file diff --git a/proto/lbm/fswap/v1/query.proto b/proto/lbm/fswap/v1/query.proto index 5b2e0d02e9..a2a88b7093 100644 --- a/proto/lbm/fswap/v1/query.proto +++ b/proto/lbm/fswap/v1/query.proto @@ -5,28 +5,51 @@ 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"; } - rpc TotalNewCurrencySwapLimit(QueryTotalSwappableAmountRequest) returns (QueryTotalSwappableAmountResponse) { - option (google.api.http).get = "/lbm/fswap/v1/swappable_new_coin_amount"; + // 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 {} +message QuerySwappedRequest { + string fromDenom = 1; + string toDenom = 2; +} message QuerySwappedResponse { - cosmos.base.v1beta1.Coin old_coin = 1 + cosmos.base.v1beta1.Coin from_coin_amount = 1 [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/Finschia/finschia-sdk/types.Coin"]; - cosmos.base.v1beta1.Coin new_coin = 2 + cosmos.base.v1beta1.Coin to_coin_amount = 2 [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/Finschia/finschia-sdk/types.Coin"]; } -message QueryTotalSwappableAmountRequest {} -message QueryTotalSwappableAmountResponse { - cosmos.base.v1beta1.Coin swappable_new_coin = 1 +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 index c9b3c171bc..07813f9eab 100644 --- a/proto/lbm/fswap/v1/tx.proto +++ b/proto/lbm/fswap/v1/tx.proto @@ -7,23 +7,26 @@ import "gogoproto/gogo.proto"; import "cosmos/base/v1beta1/coin.proto"; service Msg { - rpc Swap(MsgSwapRequest) returns (MsgSwapResponse); - rpc SwapAll(MsgSwapAllRequest) returns (MsgSwapAllResponse); + rpc Swap(MsgSwap) returns (MsgSwapResponse); + rpc SwapAll(MsgSwapAll) returns (MsgSwapAllResponse); } -message MsgSwapRequest { +message MsgSwap { // holder's address string from_address = 1; - // amount of old currency - cosmos.base.v1beta1.Coin amount = 2 + // 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 MsgSwapAllRequest { +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 f6ce763cdd..7bb68f2e01 100644 --- a/simapp/app.go +++ b/simapp/app.go @@ -76,6 +76,7 @@ import ( 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" @@ -133,6 +134,7 @@ var ( upgradeclient.ProposalHandler, upgradeclient.CancelProposalHandler, foundationclient.ProposalHandler, + fswapclient.ProposalHandler, ), params.AppModuleBasic{}, crisis.AppModuleBasic{}, @@ -159,6 +161,7 @@ var ( 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 @@ -340,13 +343,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, @@ -366,10 +373,6 @@ func NewSimApp( // If evidence needs to be handled for the app, set routes in router here and seal app.EvidenceKeeper = *evidenceKeeper - /**** Phase 1 ****/ - fswapConfig := fswaptypes.DefaultConfig() - app.FswapKeeper = fswapkeeper.NewKeeper(appCodec, keys[fswaptypes.StoreKey], app.AccountKeeper, app.BankKeeper, fswapConfig) - app.FbridgeKeeper = fbridgekeeper.NewKeeper(appCodec, keys[fbridgetypes.StoreKey], app.AccountKeeper, app.BankKeeper, "stake", authtypes.NewModuleAddress(govtypes.ModuleName).String()) /**** Module Options ****/ @@ -403,7 +406,7 @@ 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.AccountKeeper, app.BankKeeper), + fswap.NewAppModule(appCodec, app.FswapKeeper, app.BankKeeper), fbridgemodule.NewAppModule(appCodec, app.FbridgeKeeper), ) diff --git a/x/ERRORS.md b/x/ERRORS.md index 8ed09149f9..dcf56afb65 100644 --- a/x/ERRORS.md +++ b/x/ERRORS.md @@ -177,9 +177,10 @@ |Error Name|Codespace|Code|Description| |:-|:-|:-|:-| -|ErrParamsNotFound|fswap|1100|params does not exist| -|ErrSwappedNotFound|fswap|1101|swapped does not exist| -|ErrExceedSwappable|fswap|1102|exceed swappable coin amount| +|ErrInvalidState|fswap|2|swap module invalid state| +|ErrCanNotHaveMoreSwap|fswap|3|no more swap allowed| +|ErrSwappedNotFound|fswap|4|swapped does not exist| +|ErrExceedSwappableToCoinAmount|fswap|5|exceed swappable to-coin amount| >You can also find detailed information in the following Errors.go files: * [fswap/types/errors.go](fswap/types/errors.go) diff --git a/x/fswap/client/cli/query.go b/x/fswap/client/cli/query.go index 55ec1d2bd1..46c87aa868 100644 --- a/x/fswap/client/cli/query.go +++ b/x/fswap/client/cli/query.go @@ -14,7 +14,7 @@ import ( func GetQueryCmd(queryRoute string) *cobra.Command { // Group fswap queries under a subcommand cmd := &cobra.Command{ - Use: types.ModuleName, + Use: queryRoute, Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName), DisableFlagParsing: true, SuggestionsMinimumDistance: 2, @@ -24,23 +24,27 @@ func GetQueryCmd(queryRoute string) *cobra.Command { cmd.AddCommand( CmdQuerySwapped(), CmdQueryTotalSwappableAmount(), + CmdQuerySwaps(), ) return cmd } func CmdQuerySwapped() *cobra.Command { cmd := &cobra.Command{ - Use: "fswap swapped", + Use: "swapped [from_denom] [to_denom]", Short: "shows the current swap status, including both old and new coin amount", - Args: cobra.NoArgs, + 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) - - res, err := queryClient.Swapped(cmd.Context(), &types.QuerySwappedRequest{}) + req := &types.QuerySwappedRequest{ + FromDenom: args[0], + ToDenom: args[1], + } + res, err := queryClient.Swapped(cmd.Context(), req) if err != nil { return err } @@ -55,8 +59,37 @@ func CmdQuerySwapped() *cobra.Command { func CmdQueryTotalSwappableAmount() *cobra.Command { cmd := &cobra.Command{ - Use: "fswap total-swappable-amount", + 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) @@ -65,7 +98,7 @@ func CmdQueryTotalSwappableAmount() *cobra.Command { } queryClient := types.NewQueryClient(clientCtx) - res, err := queryClient.TotalNewCurrencySwapLimit(cmd.Context(), &types.QueryTotalSwappableAmountRequest{}) + res, err := queryClient.Swaps(cmd.Context(), &types.QuerySwapsRequest{}) if err != nil { return err } diff --git a/x/fswap/client/cli/tx.go b/x/fswap/client/cli/tx.go index 9b2f915ab7..433c8ae33e 100644 --- a/x/fswap/client/cli/tx.go +++ b/x/fswap/client/cli/tx.go @@ -1,8 +1,8 @@ package cli import ( + "encoding/json" "fmt" - "time" "github.com/spf13/cobra" @@ -10,10 +10,19 @@ import ( "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" ) -var DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds()) +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 { @@ -34,26 +43,31 @@ func GetTxCmd() *cobra.Command { func CmdTxMsgSwap() *cobra.Command { cmd := &cobra.Command{ - Use: "fswap swap [address] [fnsa_amount]", - Short: "swap amounts of old coin to new coin. Note, the'--from' flag is ignored as it is implied from [address].", - Args: cobra.ExactArgs(2), + 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 { - if err := cmd.Flags().Set(flags.FlagFrom, args[0]); err != nil { + 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 } - coin, err := sdk.ParseCoinNormalized(args[2]) + amount, err := sdk.ParseCoinNormalized(args[1]) if err != nil { return err } - msg := &types.MsgSwapRequest{ - FromAddress: clientCtx.GetFromAddress().String(), - Amount: coin, + toDenom := args[2] + + msg := &types.MsgSwap{ + FromAddress: from, + FromCoinAmount: amount, + ToDenom: toDenom, } if err := msg.ValidateBasic(); err != nil { return err @@ -68,24 +82,31 @@ func CmdTxMsgSwap() *cobra.Command { func CmdTxMsgSwapAll() *cobra.Command { cmd := &cobra.Command{ - Use: "fswap swap-all [address]", - Short: "swap all the old coins. Note, the'--from' flag is ignored as it is implied from [address].", - Args: cobra.ExactArgs(1), + 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 { - if err := cmd.Flags().Set(flags.FlagFrom, args[0]); err != nil { + 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 } - msg := &types.MsgSwapAllRequest{ + 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) }, } @@ -93,3 +114,142 @@ func CmdTxMsgSwapAll() *cobra.Command { 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 index 2e3dae3f45..7bae485c7e 100644 --- a/x/fswap/handler.go +++ b/x/fswap/handler.go @@ -1,26 +1,27 @@ package fswap import ( - "fmt" - 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" ) -// NewHandler ... -func NewHandler(k keeper.Keeper) sdk.Handler { - // this line is used by starport scaffolding # handler/msgServer - - return func(ctx sdk.Context, msg sdk.Msg) (*sdk.Result, error) { - // ctx = ctx.WithEventManager(sdk.NewEventManager()) +// 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) - // switch msg := msg.(type) { - // this line is used by starport scaffolding # 1 - // default: - errMsg := fmt.Sprintf("unrecognized %s message type: %T", types.ModuleName, msg) - return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, errMsg) - // } + 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/fswap.go b/x/fswap/keeper/fswap.go deleted file mode 100644 index 6100dfa111..0000000000 --- a/x/fswap/keeper/fswap.go +++ /dev/null @@ -1,30 +0,0 @@ -package keeper - -import ( - sdk "github.com/Finschia/finschia-sdk/types" - "github.com/Finschia/finschia-sdk/x/fswap/types" -) - -// GetSwapped get all parameters as types.Swapped -func (k Keeper) GetSwapped(ctx sdk.Context) types.Swapped { - store := ctx.KVStore(k.storeKey) - bz := store.Get([]byte{types.SwappedKey}) - var swapped types.Swapped - - if bz == nil { - panic(types.ErrSwappedNotFound) - } - k.cdc.MustUnmarshal(bz, &swapped) - return swapped -} - -// SetSwapped set the types.Swapped -func (k Keeper) SetSwapped(ctx sdk.Context, swapped types.Swapped) error { - store := ctx.KVStore(k.storeKey) - bz, err := k.cdc.Marshal(&swapped) - if err != nil { - return err - } - store.Set([]byte{types.SwappedKey}, bz) - return nil -} diff --git a/x/fswap/keeper/genesis.go b/x/fswap/keeper/genesis.go index 4cb0edd5e6..d27c80785a 100644 --- a/x/fswap/keeper/genesis.go +++ b/x/fswap/keeper/genesis.go @@ -5,21 +5,53 @@ import ( "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) { - if err := k.SetParams(ctx, genState.Params); err != nil { - panic(err) +// 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 err := k.SetSwapped(ctx, genState.Swapped); err != nil { - panic(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 } -// ExportGenesis returns the capability module's exported genesis. +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{ - Params: k.GetParams(ctx), - Swapped: k.GetSwapped(ctx), + 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 index ae0e07e275..c4fa1a0e99 100644 --- a/x/fswap/keeper/genesis_test.go +++ b/x/fswap/keeper/genesis_test.go @@ -1,13 +1,21 @@ package keeper_test import ( + "fmt" + "github.com/Finschia/finschia-sdk/x/fswap/types" ) func (s *KeeperTestSuite) TestInitAndExportGenesis() { - s.keeper.InitGenesis(s.sdkCtx, *types.DefaultGenesis()) - got := s.keeper.ExportGenesis(s.sdkCtx) - s.Require().NotNil(got) - s.Require().Equal(types.DefaultParams(), got.Params) - s.Require().Equal(types.DefaultSwapped(), got.Swapped) + 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 index b55b7c1155..def3ee5ffb 100644 --- a/x/fswap/keeper/grpc_query.go +++ b/x/fswap/keeper/grpc_query.go @@ -3,17 +3,68 @@ 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 = Keeper{} +var _ types.QueryServer = QueryServer{} -// Swapped implements types.QueryServer. -func (k Keeper) Swapped(context.Context, *types.QuerySwappedRequest) (*types.QuerySwappedResponse, error) { - panic("unimplemented") +type QueryServer struct { + Keeper } -// TotalNewCurrencySwapLimit implements types.QueryServer. -func (k Keeper) TotalNewCurrencySwapLimit(context.Context, *types.QueryTotalSwappableAmountRequest) (*types.QueryTotalSwappableAmountResponse, error) { - panic("unimplemented") +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/grpc_query_params_test.go b/x/fswap/keeper/grpc_query_params_test.go deleted file mode 100644 index 9429264902..0000000000 --- a/x/fswap/keeper/grpc_query_params_test.go +++ /dev/null @@ -1 +0,0 @@ -package keeper_test diff --git a/x/fswap/keeper/keeper.go b/x/fswap/keeper/keeper.go index 3036a079e2..f21a246cea 100644 --- a/x/fswap/keeper/keeper.go +++ b/x/fswap/keeper/keeper.go @@ -6,37 +6,198 @@ import ( "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 - accountKeeper types.AccountKeeper - bankKeeper types.BankKeeper - config types.Config - } -) +type Keeper struct { + cdc codec.BinaryCodec + storeKey storetypes.StoreKey + + config types.Config + + BankKeeper +} -func NewKeeper( - cdc codec.BinaryCodec, - storeKey storetypes.StoreKey, - ak types.AccountKeeper, - bk types.BankKeeper, - config types.Config, -) Keeper { +func NewKeeper(cdc codec.BinaryCodec, storeKey storetypes.StoreKey, config types.Config, bk BankKeeper) Keeper { return Keeper{ - cdc: cdc, - storeKey: storeKey, - accountKeeper: ak, - bankKeeper: bk, - config: config, + 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 index dc87a7e267..fdf9e95d25 100644 --- a/x/fswap/keeper/keeper_test.go +++ b/x/fswap/keeper/keeper_test.go @@ -4,40 +4,186 @@ import ( "context" "testing" - "github.com/golang/mock/gomock" "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/testutil" "github.com/Finschia/finschia-sdk/x/fswap/types" + minttypes "github.com/Finschia/finschia-sdk/x/mint/types" ) type KeeperTestSuite struct { suite.Suite - sdkCtx sdk.Context - goCtx context.Context - keeper keeper.Keeper - bankKeeper types.BankKeeper - msgServer types.MsgServer + 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 TestKeeperTestSuite(t *testing.T) { - suite.Run(t, new(KeeperTestSuite)) +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() { - ctrl := gomock.NewController(s.T()) - bankKeeper := testutil.NewMockBankKeeper(ctrl) - s.bankKeeper = bankKeeper checkTx := false app := simapp.Setup(checkTx) - s.sdkCtx = app.BaseApp.NewContext(checkTx, tmproto.Header{}) - s.goCtx = sdk.WrapSDKContext(s.sdkCtx) + 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) - s.msgServer = keeper.NewMsgServerImpl(s.keeper) + 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 index 41b76b832a..1f3086fc4f 100644 --- a/x/fswap/keeper/msg_server.go +++ b/x/fswap/keeper/msg_server.go @@ -3,27 +3,60 @@ 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" ) -type msgServer struct { - Keeper +var _ types.MsgServer = MsgServer{} + +type MsgServer struct { + keeper Keeper } -// NewMsgServerImpl returns an implementation of the MsgServer interface -// for the provided Keeper. -func NewMsgServerImpl(keeper Keeper) types.MsgServer { - return &msgServer{Keeper: keeper} +func NewMsgServer(keeper Keeper) *MsgServer { + return &MsgServer{keeper} } -var _ types.MsgServer = msgServer{} +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 + } -// Swap implements types.MsgServer. -func (m msgServer) Swap(context.Context, *types.MsgSwapRequest) (*types.MsgSwapResponse, error) { - panic("unimplemented") + if err := s.keeper.Swap(c, from, req.GetFromCoinAmount(), req.GetToDenom()); err != nil { + return nil, err + } + + return &types.MsgSwapResponse{}, nil } -// SwapAll implements types.MsgServer. -func (m msgServer) SwapAll(context.Context, *types.MsgSwapAllRequest) (*types.MsgSwapAllResponse, error) { - panic("unimplemented") +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 index 9429264902..6e7953ac64 100644 --- a/x/fswap/keeper/msg_server_test.go +++ b/x/fswap/keeper/msg_server_test.go @@ -1 +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/params.go b/x/fswap/keeper/params.go deleted file mode 100644 index 5578a6d760..0000000000 --- a/x/fswap/keeper/params.go +++ /dev/null @@ -1,35 +0,0 @@ -package keeper - -import ( - sdk "github.com/Finschia/finschia-sdk/types" - sdkerrors "github.com/Finschia/finschia-sdk/types/errors" - "github.com/Finschia/finschia-sdk/x/fswap/types" -) - -// GetParams get all parameters as types.Params -func (k Keeper) GetParams(ctx sdk.Context) types.Params { - store := ctx.KVStore(k.storeKey) - bz := store.Get([]byte{types.ParamsKey}) - var params types.Params - if bz == nil { - panic(sdkerrors.ErrNotFound) - } - k.cdc.MustUnmarshal(bz, ¶ms) - return params -} - -// SetParams set the params -func (k Keeper) SetParams(ctx sdk.Context, params types.Params) error { - store := ctx.KVStore(k.storeKey) - bz, err := k.cdc.Marshal(¶ms) - if err != nil { - return err - } - store.Set([]byte{types.ParamsKey}, bz) - return nil -} - -func (k Keeper) SwappableNewCoinAmount(ctx sdk.Context) sdk.Int { - params := k.GetParams(ctx) - return params.SwappableNewCoinAmount -} 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/keeper/query_params_test.go b/x/fswap/keeper/query_params_test.go deleted file mode 100644 index 9429264902..0000000000 --- a/x/fswap/keeper/query_params_test.go +++ /dev/null @@ -1 +0,0 @@ -package keeper_test diff --git a/x/fswap/module.go b/x/fswap/module.go index 724b883a9e..d561bbe296 100644 --- a/x/fswap/module.go +++ b/x/fswap/module.go @@ -28,7 +28,7 @@ var ( // AppModuleBasic // ---------------------------------------------------------------------------- -// AppModuleBasic implements the AppModuleBasic interface for the capability module. +// AppModuleBasic implements the AppModuleBasic interface for the fswap module. type AppModuleBasic struct { cdc codec.BinaryCodec } @@ -37,31 +37,25 @@ func NewAppModuleBasic(cdc codec.BinaryCodec) AppModuleBasic { return AppModuleBasic{cdc: cdc} } -// Name returns the capability module's name. +// Name returns the fswap module's name. func (AppModuleBasic) Name() string { return types.ModuleName } -func (AppModuleBasic) RegisterCodec(cdc *codec.LegacyAmino) { - types.RegisterCodec(cdc) -} - -func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - types.RegisterCodec(cdc) -} +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 capability module's default genesis state. +// 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 capability module. -func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { +// 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) @@ -74,12 +68,12 @@ func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *r // this line is used by starport scaffolding # 2 } -// GetTxCmd returns the capability module's root tx command. +// GetTxCmd returns the fswap module's root tx command. func (a AppModuleBasic) GetTxCmd() *cobra.Command { return cli.GetTxCmd() } -// GetQueryCmd returns the capability module's root query command. +// GetQueryCmd returns the fswap module's root query command. func (AppModuleBasic) GetQueryCmd() *cobra.Command { return cli.GetQueryCmd(types.StoreKey) } @@ -88,69 +82,65 @@ func (AppModuleBasic) GetQueryCmd() *cobra.Command { // AppModule // ---------------------------------------------------------------------------- -// AppModule implements the AppModule interface for the capability module. +// AppModule implements the AppModule interface for the fswap module. type AppModule struct { AppModuleBasic - keeper keeper.Keeper - accountKeeper types.AccountKeeper - bankKeeper types.BankKeeper + keeper keeper.Keeper + bankKeeper keeper.BankKeeper } func NewAppModule( cdc codec.Codec, keeper keeper.Keeper, - accountKeeper types.AccountKeeper, - bankKeeper types.BankKeeper, + bankKeeper keeper.BankKeeper, ) AppModule { return AppModule{ AppModuleBasic: NewAppModuleBasic(cdc), keeper: keeper, - accountKeeper: accountKeeper, bankKeeper: bankKeeper, } } -// Name returns the capability module's name. +// Name returns the fswap module's name. func (am AppModule) Name() string { return am.AppModuleBasic.Name() } -// Route returns the capability module's message routing key. -func (am AppModule) Route() sdk.Route { - return sdk.NewRoute(types.RouterKey, NewHandler(am.keeper)) -} +// Route returns the fswap module's message routing key. +func (AppModule) Route() sdk.Route { return sdk.Route{} } -// QuerierRoute returns the capability module's query routing key. +// QuerierRoute returns the fswap module's query routing key. func (AppModule) QuerierRoute() string { return types.QuerierRoute } -// LegacyQuerierHandler returns the capability module's Querier. -func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sdk.Querier { +// 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(), am.keeper) + types.RegisterQueryServer(cfg.QueryServer(), keeper.NewQueryServer(am.keeper)) + types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServer(am.keeper)) } -// RegisterInvariants registers the capability module's invariants. +// RegisterInvariants registers the fswap module's invariants. func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} -// InitGenesis performs the capability module's genesis initialization It returns +// 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 { - var genState types.GenesisState + genState := types.GenesisState{} // Initialize global index to index in genesis state cdc.MustUnmarshalJSON(gs, &genState) - - am.keeper.InitGenesis(ctx, genState) - + if err := am.keeper.InitGenesis(ctx, &genState); err != nil { + panic(err) + } return []abci.ValidatorUpdate{} } -// ExportGenesis returns the capability module's exported genesis state as raw JSON bytes. +// 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) @@ -159,10 +149,10 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw // ConsensusVersion implements ConsensusVersion. func (AppModule) ConsensusVersion() uint64 { return 1 } -// BeginBlock executes all ABCI BeginBlock logic respective to the capability module. +// 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 capability module. It +// 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 index 4748931d47..1a4d90d6be 100644 --- a/x/fswap/module_simulation.go +++ b/x/fswap/module_simulation.go @@ -6,14 +6,15 @@ import ( 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/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) { - simulation.RandomizedGenState(simState) + fswapGenesis := types.DefaultGenesis() + simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(fswapGenesis) } // RegisterStoreDecoder registers a decoder. 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 index f84ff0b243..02eddda2ba 100644 --- a/x/fswap/simulation/genesis.go +++ b/x/fswap/simulation/genesis.go @@ -1,65 +1 @@ package simulation - -import ( - "encoding/json" - "fmt" - "math/rand" - - sdk "github.com/Finschia/finschia-sdk/types" - "github.com/Finschia/finschia-sdk/types/module" - "github.com/Finschia/finschia-sdk/x/fswap/types" -) - -// Simulation parameter constants -const ( - OldCoinAmount = "old_coin_amount" - NewCoinAmount = "new_coin_amount" - SwappableNewCoinAmount = "swappable_new_coin_amount" -) - -// GenOldCoinAmount randomized oldCoinAmount -func GenOldCoinAmount(r *rand.Rand) sdk.Int { - return sdk.NewInt(int64(r.Intn(1001) + 1000)) -} - -// GenNewCoinAmount randomized oldCoinAmount -func GenNewCoinAmount(r *rand.Rand) sdk.Int { - return sdk.NewInt(int64(r.Intn(100001) + 100000)) -} - -// GenSwappableNewCoinAmount randomized swappableNewCoinAmount -func GenSwappableNewCoinAmount(r *rand.Rand) sdk.Int { - return sdk.NewInt(int64(r.Intn(100001) + 200000)) -} - -// RandomizedGenState generates a random GenesisState for fswap -func RandomizedGenState(simState *module.SimulationState) { - var oldCoinAmount sdk.Int - simState.AppParams.GetOrGenerate( - simState.Cdc, OldCoinAmount, &oldCoinAmount, simState.Rand, - func(r *rand.Rand) { oldCoinAmount = GenOldCoinAmount(r) }, - ) - - var newCoinAmount sdk.Int - simState.AppParams.GetOrGenerate( - simState.Cdc, NewCoinAmount, &newCoinAmount, simState.Rand, - func(r *rand.Rand) { newCoinAmount = GenNewCoinAmount(r) }, - ) - - var swappableNewCoinAmount sdk.Int - simState.AppParams.GetOrGenerate( - simState.Cdc, SwappableNewCoinAmount, &swappableNewCoinAmount, simState.Rand, - func(r *rand.Rand) { swappableNewCoinAmount = GenSwappableNewCoinAmount(r) }, - ) - - fswapParams := types.NewParams(swappableNewCoinAmount) - fswapSwapped := types.NewSwapped(oldCoinAmount, newCoinAmount) - fswapGenesis := types.NewGenesisState(fswapParams, fswapSwapped) - - bz, err := json.MarshalIndent(&fswapGenesis, "", " ") - if err != nil { - panic(err) - } - fmt.Printf("Selected randomly generated fswap parameters:\n%s\n", bz) - simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(fswapGenesis) -} diff --git a/x/fswap/simulation/genesis_test.go b/x/fswap/simulation/genesis_test.go index 00ac1852d7..5c6452f9a0 100644 --- a/x/fswap/simulation/genesis_test.go +++ b/x/fswap/simulation/genesis_test.go @@ -1,78 +1 @@ package simulation_test - -import ( - "encoding/json" - "math/rand" - "testing" - - "github.com/stretchr/testify/require" - - "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" - simtypes "github.com/Finschia/finschia-sdk/types/simulation" - "github.com/Finschia/finschia-sdk/x/fswap/simulation" - "github.com/Finschia/finschia-sdk/x/fswap/types" -) - -// TestRandomizedGenState tests the normal scenario of applying RandomizedGenState. -// Abonormal scenarios are not tested here. -func TestRandomizedGenState(t *testing.T) { - interfaceRegistry := codectypes.NewInterfaceRegistry() - cdc := codec.NewProtoCodec(interfaceRegistry) - - s := rand.NewSource(1) - r := rand.New(s) - - simState := module.SimulationState{ - AppParams: make(simtypes.AppParams), - Cdc: cdc, - Rand: r, - NumBonded: 3, - Accounts: simtypes.RandomAccounts(r, 3), - InitialStake: 1000, - GenState: make(map[string]json.RawMessage), - } - - simulation.RandomizedGenState(&simState) - - var fswapGenesis types.GenesisState - - int1 := sdk.NewInt(296839) - int2 := sdk.NewInt(1754) - int3 := sdk.NewInt(138374) - simState.Cdc.MustUnmarshalJSON(simState.GenState[types.ModuleName], &fswapGenesis) - require.Equal(t, int1, fswapGenesis.Params.SwappableNewCoinAmount) - require.Equal(t, int2, fswapGenesis.Swapped.OldCoinAmount) - require.Equal(t, int3, fswapGenesis.Swapped.NewCoinAmount) -} - -// TestRandomizedGenState tests abnormal scenarios of applying RandomizedGenState. -func TestRandomizedGenState1(t *testing.T) { - interfaceRegistry := codectypes.NewInterfaceRegistry() - cdc := codec.NewProtoCodec(interfaceRegistry) - - s := rand.NewSource(1) - r := rand.New(s) - // all these tests will panic - tests := []struct { - simState module.SimulationState - panicMsg string - }{ - { // panic => reason: incomplete initialization of the simState - module.SimulationState{}, "invalid memory address or nil pointer dereference"}, - { // panic => reason: incomplete initialization of the simState - module.SimulationState{ - AppParams: make(simtypes.AppParams), - Cdc: cdc, - Rand: r, - }, "assignment to entry in nil map"}, - } - - for _, tt := range tests { - tt := tt - - require.Panicsf(t, func() { simulation.RandomizedGenState(&tt.simState) }, tt.panicMsg) - } -} 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 index 21bb92feaf..8718d93937 100644 --- a/x/fswap/testutil/expected_keepers_mocks.go +++ b/x/fswap/testutil/expected_keepers_mocks.go @@ -1,5 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: x/fswap/types/expected_keepers.go +// Source: x/fswap/keeper/expected_keepers.go // Package testutil is a generated GoMock package. package testutil @@ -7,95 +7,147 @@ package testutil import ( reflect "reflect" - types "github.com/Finschia/finschia-sdk/types" - types0 "github.com/Finschia/finschia-sdk/x/auth/types" + 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" ) -// MockAccountKeeper is a mock of AccountKeeper interface. -type MockAccountKeeper struct { +// MockBankKeeper is a mock of BankKeeper interface. +type MockBankKeeper struct { ctrl *gomock.Controller - recorder *MockAccountKeeperMockRecorder + recorder *MockBankKeeperMockRecorder } -// MockAccountKeeperMockRecorder is the mock recorder for MockAccountKeeper. -type MockAccountKeeperMockRecorder struct { - mock *MockAccountKeeper +// MockBankKeeperMockRecorder is the mock recorder for MockBankKeeper. +type MockBankKeeperMockRecorder struct { + mock *MockBankKeeper } -// NewMockAccountKeeper creates a new mock instance. -func NewMockAccountKeeper(ctrl *gomock.Controller) *MockAccountKeeper { - mock := &MockAccountKeeper{ctrl: ctrl} - mock.recorder = &MockAccountKeeperMockRecorder{mock} +// 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 *MockAccountKeeper) EXPECT() *MockAccountKeeperMockRecorder { +func (m *MockBankKeeper) EXPECT() *MockBankKeeperMockRecorder { return m.recorder } -// GetAccount mocks base method. -func (m *MockAccountKeeper) GetAccount(ctx types.Context, addr types.AccAddress) types0.AccountI { +// 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, "GetAccount", ctx, addr) - ret0, _ := ret[0].(types0.AccountI) + ret := m.ctrl.Call(m, "BurnCoins", ctx, moduleName, amt) + ret0, _ := ret[0].(error) return ret0 } -// GetAccount indicates an expected call of GetAccount. -func (mr *MockAccountKeeperMockRecorder) GetAccount(ctx, addr interface{}) *gomock.Call { +// 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, "GetAccount", reflect.TypeOf((*MockAccountKeeper)(nil).GetAccount), ctx, addr) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BurnCoins", reflect.TypeOf((*MockBankKeeper)(nil).BurnCoins), ctx, moduleName, amt) } -// MockBankKeeper is a mock of BankKeeper interface. -type MockBankKeeper struct { - ctrl *gomock.Controller - recorder *MockBankKeeperMockRecorder +// 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 } -// MockBankKeeperMockRecorder is the mock recorder for MockBankKeeper. -type MockBankKeeperMockRecorder struct { - mock *MockBankKeeper +// 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) } -// NewMockBankKeeper creates a new mock instance. -func NewMockBankKeeper(ctrl *gomock.Controller) *MockBankKeeper { - mock := &MockBankKeeper{ctrl: ctrl} - mock.recorder = &MockBankKeeperMockRecorder{mock} - return mock +// 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 } -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockBankKeeper) EXPECT() *MockBankKeeperMockRecorder { - return m.recorder +// 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) } -// GetSupply mocks base method. -func (m *MockBankKeeper) GetSupply(ctx types.Context, denom string) types.Coin { +// IsSendEnabledCoins mocks base method. +func (m *MockBankKeeper) IsSendEnabledCoins(ctx types0.Context, coins ...types0.Coin) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetSupply", ctx, denom) - ret0, _ := ret[0].(types.Coin) + varargs := []interface{}{ctx} + for _, a := range coins { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "IsSendEnabledCoins", varargs...) + ret0, _ := ret[0].(error) return ret0 } -// GetSupply indicates an expected call of GetSupply. -func (mr *MockBankKeeperMockRecorder) GetSupply(ctx, denom interface{}) *gomock.Call { +// IsSendEnabledCoins indicates an expected call of IsSendEnabledCoins. +func (mr *MockBankKeeperMockRecorder) IsSendEnabledCoins(ctx interface{}, coins ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSupply", reflect.TypeOf((*MockBankKeeper)(nil).GetSupply), ctx, denom) + varargs := append([]interface{}{ctx}, coins...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsSendEnabledCoins", reflect.TypeOf((*MockBankKeeper)(nil).IsSendEnabledCoins), varargs...) } -// SpendableCoins mocks base method. -func (m *MockBankKeeper) SpendableCoins(ctx types.Context, addr types.AccAddress) types.Coins { +// 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, "SpendableCoins", ctx, addr) - ret0, _ := ret[0].(types.Coins) + ret := m.ctrl.Call(m, "MintCoins", ctx, moduleName, amt) + ret0, _ := ret[0].(error) return ret0 } -// SpendableCoins indicates an expected call of SpendableCoins. -func (mr *MockBankKeeperMockRecorder) SpendableCoins(ctx, addr interface{}) *gomock.Call { +// 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, "SpendableCoins", reflect.TypeOf((*MockBankKeeper)(nil).SpendableCoins), ctx, addr) + 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 index 72003233c5..de8865ec57 100644 --- a/x/fswap/types/codec.go +++ b/x/fswap/types/codec.go @@ -2,22 +2,38 @@ package types import ( "github.com/Finschia/finschia-sdk/codec" - cdctypes "github.com/Finschia/finschia-sdk/codec/types" - // this line is used by starport scaffolding # 1 + "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" ) -func RegisterCodec(cdc *codec.LegacyAmino) { - // this line is used by starport scaffolding # 2 +// 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 cdctypes.InterfaceRegistry) { - // this line is used by starport scaffolding # 3 +func RegisterInterfaces(registry types.InterfaceRegistry) { + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgSwap{}, + &MsgSwapAll{}, + ) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) + + registry.RegisterImplementations( + (*govtypes.Content)(nil), + &MakeSwapProposal{}, + ) } -var ( - Amino = codec.NewLegacyAmino() - ModuleCdc = codec.NewProtoCodec(cdctypes.NewInterfaceRegistry()) -) +func init() { + RegisterLegacyAminoCodec(govcodec.Amino) + RegisterLegacyAminoCodec(fscodec.Amino) +} diff --git a/x/fswap/types/config.go b/x/fswap/types/config.go index d2e57a05aa..071a0cab1f 100644 --- a/x/fswap/types/config.go +++ b/x/fswap/types/config.go @@ -1,24 +1,13 @@ package types -import ( - sdk "github.com/Finschia/finschia-sdk/types" -) - -// Config is a config struct used for intialising the fswap module to avoid using globals. type Config struct { - // OldCoinDenom defines the old coin denom. - OldCoinDenom string - // NewCoinDenom defines the new coin denom. - NewCoinDenom string - // SwapRate defines the swap rate. - SwapRate sdk.Int + MaxSwaps int + UpdateAllowed bool } -// DefaultConfig returns the default config for fswap. func DefaultConfig() Config { return Config{ - OldCoinDenom: "cony", - NewCoinDenom: "PDT", - SwapRate: sdk.NewInt(148079656000000), + MaxSwaps: 1, + UpdateAllowed: false, } } diff --git a/x/fswap/types/errors.go b/x/fswap/types/errors.go index 3a18f66f20..24e0fa6c11 100644 --- a/x/fswap/types/errors.go +++ b/x/fswap/types/errors.go @@ -8,7 +8,8 @@ import ( // x/fswap module sentinel errors var ( - ErrParamsNotFound = sdkerrors.Register(ModuleName, 1100, "params does not exist") - ErrSwappedNotFound = sdkerrors.Register(ModuleName, 1101, "swapped does not exist") - ErrExceedSwappable = sdkerrors.Register(ModuleName, 1102, "exceed swappable coin amount") + 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 index d3e5284230..6461787a83 100644 --- a/x/fswap/types/event.pb.go +++ b/x/fswap/types/event.pb.go @@ -27,10 +27,10 @@ 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"` - // amount of the old currency - OldCoin types.Coin `protobuf:"bytes,2,opt,name=old_coin,json=oldCoin,proto3,castrepeated=github.com/Finschia/finschia-sdk/types.Coin" json:"old_coin"` - // amount of the new currency - NewCoin types.Coin `protobuf:"bytes,3,opt,name=new_coin,json=newCoin,proto3,castrepeated=github.com/Finschia/finschia-sdk/types.Coin" json:"new_coin"` + // 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{} } @@ -73,16 +73,16 @@ func (m *EventSwapCoins) GetAddress() string { return "" } -func (m *EventSwapCoins) GetOldCoin() types.Coin { +func (m *EventSwapCoins) GetFromCoinAmount() types.Coin { if m != nil { - return m.OldCoin + return m.FromCoinAmount } return types.Coin{} } -func (m *EventSwapCoins) GetNewCoin() types.Coin { +func (m *EventSwapCoins) GetToCoinAmount() types.Coin { if m != nil { - return m.NewCoin + return m.ToCoinAmount } return types.Coin{} } @@ -94,25 +94,26 @@ func init() { func init() { proto.RegisterFile("lbm/fswap/v1/event.proto", fileDescriptor_92d5edbd64a725af) } var fileDescriptor_92d5edbd64a725af = []byte{ - // 278 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x91, 0xb1, 0x4e, 0xc3, 0x30, - 0x10, 0x86, 0xe3, 0x22, 0x51, 0x08, 0x88, 0xa1, 0x62, 0x08, 0x1d, 0xdc, 0x8a, 0xa9, 0x12, 0xc2, - 0x56, 0xe8, 0x1b, 0x80, 0x40, 0xcc, 0x65, 0x63, 0x41, 0x76, 0xe2, 0xa6, 0x16, 0x89, 0x2f, 0xea, - 0x99, 0x04, 0x36, 0x1e, 0x81, 0xe7, 0xe0, 0x49, 0x3a, 0x76, 0x64, 0x02, 0x94, 0xbc, 0x08, 0xb2, - 0x13, 0x66, 0x26, 0xb6, 0xff, 0xf4, 0xdf, 0xff, 0xfd, 0xd2, 0x5d, 0x18, 0xe5, 0xb2, 0xe0, 0x4b, - 0xac, 0x45, 0xc9, 0xab, 0x98, 0xab, 0x4a, 0x19, 0xcb, 0xca, 0x35, 0x58, 0x18, 0x1d, 0xe6, 0xb2, - 0x60, 0xde, 0x61, 0x55, 0x3c, 0x3e, 0xce, 0x20, 0x03, 0x6f, 0x70, 0xa7, 0xba, 0x9d, 0x31, 0x4d, - 0x00, 0x0b, 0x40, 0x2e, 0x05, 0x2a, 0x5e, 0xc5, 0x52, 0x59, 0x11, 0xf3, 0x04, 0xb4, 0xe9, 0xfc, - 0xd3, 0xd7, 0x41, 0x78, 0x74, 0xed, 0x98, 0x77, 0xb5, 0x28, 0xaf, 0x40, 0x1b, 0x1c, 0x45, 0xe1, - 0x50, 0xa4, 0xe9, 0x5a, 0x21, 0x46, 0x64, 0x4a, 0x66, 0xfb, 0x8b, 0xdf, 0x71, 0xa4, 0xc3, 0x3d, - 0xc8, 0xd3, 0x07, 0x17, 0x8f, 0x06, 0x53, 0x32, 0x3b, 0xb8, 0x38, 0x61, 0x1d, 0x9f, 0x39, 0x3e, - 0xeb, 0xf9, 0xcc, 0x71, 0x2e, 0xe7, 0x9b, 0xcf, 0x49, 0xf0, 0xfe, 0x35, 0x39, 0xcb, 0xb4, 0x5d, - 0x3d, 0x49, 0x96, 0x40, 0xc1, 0x6f, 0xb4, 0xc1, 0x64, 0xa5, 0x05, 0x5f, 0xf6, 0xe2, 0x1c, 0xd3, - 0x47, 0x6e, 0x5f, 0x4a, 0x85, 0x3e, 0xb4, 0x18, 0x42, 0x9e, 0x3a, 0xe1, 0xaa, 0x8c, 0xaa, 0xbb, - 0xaa, 0x9d, 0xff, 0xa9, 0x32, 0xaa, 0xf6, 0xe9, 0xdb, 0x4d, 0x43, 0xc9, 0xb6, 0xa1, 0xe4, 0xbb, - 0xa1, 0xe4, 0xad, 0xa5, 0xc1, 0xb6, 0xa5, 0xc1, 0x47, 0x4b, 0x83, 0x7b, 0xf6, 0x27, 0xef, 0xb9, - 0xff, 0x8c, 0xe7, 0xca, 0x5d, 0x7f, 0xd3, 0xf9, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xb7, 0x1e, - 0x90, 0x67, 0xb3, 0x01, 0x00, 0x00, + // 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) { @@ -136,7 +137,7 @@ func (m *EventSwapCoins) MarshalToSizedBuffer(dAtA []byte) (int, error) { var l int _ = l { - size, err := m.NewCoin.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.ToCoinAmount.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -146,7 +147,7 @@ func (m *EventSwapCoins) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x1a { - size, err := m.OldCoin.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.FromCoinAmount.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -186,9 +187,9 @@ func (m *EventSwapCoins) Size() (n int) { if l > 0 { n += 1 + l + sovEvent(uint64(l)) } - l = m.OldCoin.Size() + l = m.FromCoinAmount.Size() n += 1 + l + sovEvent(uint64(l)) - l = m.NewCoin.Size() + l = m.ToCoinAmount.Size() n += 1 + l + sovEvent(uint64(l)) return n } @@ -262,7 +263,7 @@ func (m *EventSwapCoins) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OldCoin", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field FromCoinAmount", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -289,13 +290,13 @@ func (m *EventSwapCoins) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.OldCoin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + 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 NewCoin", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ToCoinAmount", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -322,7 +323,7 @@ func (m *EventSwapCoins) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.NewCoin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.ToCoinAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/fswap/types/expected_keepers.go b/x/fswap/types/expected_keepers.go deleted file mode 100644 index 195cd89bdc..0000000000 --- a/x/fswap/types/expected_keepers.go +++ /dev/null @@ -1,19 +0,0 @@ -package types - -import ( - sdk "github.com/Finschia/finschia-sdk/types" - "github.com/Finschia/finschia-sdk/x/auth/types" -) - -// AccountKeeper defines the expected account keeper used for simulations (noalias) -type AccountKeeper interface { - GetAccount(ctx sdk.Context, addr sdk.AccAddress) types.AccountI - // Methods imported from account should be defined here -} - -// BankKeeper defines the expected interface needed to retrieve account balances. -type BankKeeper interface { - SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins - // Methods imported from bank should be defined here - GetSupply(ctx sdk.Context, denom string) sdk.Coin -} diff --git a/x/fswap/types/fswap.go b/x/fswap/types/fswap.go index 76803ed5f3..c307c826b3 100644 --- a/x/fswap/types/fswap.go +++ b/x/fswap/types/fswap.go @@ -1,59 +1,76 @@ package types import ( - fmt "fmt" - "gopkg.in/yaml.v2" sdk "github.com/Finschia/finschia-sdk/types" + sdkerrors "github.com/Finschia/finschia-sdk/types/errors" ) -// NewSwapped creates a new Swapped instance -func NewSwapped( - oldCoinAmount sdk.Int, - newCoinAmount sdk.Int, -) Swapped { - return Swapped{ - OldCoinAmount: oldCoinAmount, - NewCoinAmount: newCoinAmount, +// 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 } -// DefaultSwapped returns an initial Swapped object -func DefaultSwapped() Swapped { - return NewSwapped(sdk.ZeroInt(), sdk.ZeroInt()) +func (s *Swap) String() string { + out, _ := yaml.Marshal(s) + return string(out) } -func validateCoinAmount(i interface{}) error { - v, ok := i.(sdk.Int) - if !ok { - return fmt.Errorf("invalid coin amount: %T", i) +func (s *SwapStats) ValidateBasic() error { + if s.SwapCount < 0 { + return ErrInvalidState.Wrap("swap count cannot be negative") } + return nil +} - if v.IsNil() { - return fmt.Errorf("coin amount must be not nil") - } +func (s *SwapStats) String() string { + out, _ := yaml.Marshal(s) + return string(out) +} - if v.LT(sdk.ZeroInt()) { - return fmt.Errorf("coin amount cannot be lower than 0") +// 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 } -// Validate validates the set of swapped -func (s Swapped) Validate() error { - if err := validateCoinAmount(s.OldCoinAmount); err != nil { - return err +func validateCoinAmount(i interface{}) error { + v, ok := i.(sdk.Coin) + if !ok { + return sdkerrors.ErrInvalidCoins.Wrapf("invalid coin amount: %T", i) } - if err := validateCoinAmount(s.NewCoinAmount); err != nil { - return err + 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 { +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 index 1923c31269..4449b20bec 100644 --- a/x/fswap/types/fswap.pb.go +++ b/x/fswap/types/fswap.pb.go @@ -6,6 +6,8 @@ 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" @@ -24,15 +26,179 @@ var _ = math.Inf // 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 { - OldCoinAmount github_com_Finschia_finschia_sdk_types.Int `protobuf:"bytes,1,opt,name=old_coin_amount,json=oldCoinAmount,proto3,customtype=github.com/Finschia/finschia-sdk/types.Int" json:"old_coin_amount"` - NewCoinAmount github_com_Finschia_finschia_sdk_types.Int `protobuf:"bytes,2,opt,name=new_coin_amount,json=newCoinAmount,proto3,customtype=github.com/Finschia/finschia-sdk/types.Int" json:"new_coin_amount"` + 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{0} + return fileDescriptor_42ca60eaf37a2b67, []int{3} } func (m *Swapped) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -61,29 +227,264 @@ func (m *Swapped) XXX_DiscardUnknown() { 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{ - // 230 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xc8, 0x49, 0xca, 0xd5, - 0x4f, 0x2b, 0x2e, 0x4f, 0x2c, 0xd0, 0x2f, 0x33, 0x84, 0x30, 0xf4, 0x0a, 0x8a, 0xf2, 0x4b, 0xf2, - 0x85, 0x78, 0x72, 0x92, 0x72, 0xf5, 0x20, 0x02, 0x65, 0x86, 0x52, 0x22, 0xe9, 0xf9, 0xe9, 0xf9, - 0x60, 0x09, 0x7d, 0x10, 0x0b, 0xa2, 0x46, 0xe9, 0x38, 0x23, 0x17, 0x7b, 0x70, 0x79, 0x62, 0x41, - 0x41, 0x6a, 0x8a, 0x50, 0x14, 0x17, 0x7f, 0x7e, 0x4e, 0x4a, 0x7c, 0x72, 0x7e, 0x66, 0x5e, 0x7c, - 0x62, 0x6e, 0x7e, 0x69, 0x5e, 0x89, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0xa7, 0x93, 0xd1, 0x89, 0x7b, - 0xf2, 0x0c, 0xb7, 0xee, 0xc9, 0x6b, 0xa5, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, - 0xea, 0xbb, 0x65, 0xe6, 0x15, 0x27, 0x67, 0x64, 0x26, 0xea, 0xa7, 0x41, 0x19, 0xba, 0xc5, 0x29, - 0xd9, 0xfa, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x7a, 0x9e, 0x79, 0x25, 0x41, 0xbc, 0xf9, 0x39, 0x29, - 0xce, 0xf9, 0x99, 0x79, 0x8e, 0x60, 0x83, 0x40, 0x66, 0xe7, 0xa5, 0x96, 0xa3, 0x98, 0xcd, 0x44, - 0xbe, 0xd9, 0x79, 0xa9, 0xe5, 0x08, 0xb3, 0xad, 0x58, 0x66, 0x2c, 0x90, 0x67, 0x70, 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, 0x3d, 0x82, 0x46, 0x57, 0x40, 0x03, - 0x10, 0x6c, 0x45, 0x12, 0x1b, 0x38, 0x68, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x82, 0xb7, - 0x84, 0x0e, 0x5a, 0x01, 0x00, 0x00, + // 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) { @@ -107,21 +508,21 @@ func (m *Swapped) MarshalToSizedBuffer(dAtA []byte) (int, error) { var l int _ = l { - size := m.NewCoinAmount.Size() - i -= size - if _, err := m.NewCoinAmount.MarshalTo(dAtA[i:]); err != nil { + 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 := m.OldCoinAmount.Size() - i -= size - if _, err := m.OldCoinAmount.MarshalTo(dAtA[i:]); err != nil { + size, err := m.FromCoinAmount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { return 0, err } + i -= size i = encodeVarintFswap(dAtA, i, uint64(size)) } i-- @@ -140,15 +541,69 @@ func encodeVarintFswap(dAtA []byte, offset int, v uint64) int { 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.OldCoinAmount.Size() + l = m.FromCoinAmount.Size() n += 1 + l + sovFswap(uint64(l)) - l = m.NewCoinAmount.Size() + l = m.ToCoinAmount.Size() n += 1 + l + sovFswap(uint64(l)) return n } @@ -159,7 +614,7 @@ func sovFswap(x uint64) (n int) { func sozFswap(x uint64) (n int) { return sovFswap(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *Swapped) Unmarshal(dAtA []byte) error { +func (m *Swap) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -182,15 +637,15 @@ func (m *Swapped) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Swapped: wiretype end group for non-group") + return fmt.Errorf("proto: Swap: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Swapped: illegal tag %d (wire type %d)", fieldNum, wire) + 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 OldCoinAmount", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field FromDenom", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -218,13 +673,11 @@ func (m *Swapped) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.OldCoinAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.FromDenom = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NewCoinAmount", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ToDenom", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -252,7 +705,438 @@ func (m *Swapped) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.NewCoinAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + 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 diff --git a/x/fswap/types/genesis.go b/x/fswap/types/genesis.go index 816ef241d0..08c1d79338 100644 --- a/x/fswap/types/genesis.go +++ b/x/fswap/types/genesis.go @@ -1,29 +1,39 @@ package types -// NewGenesis creates a new genesis state -func NewGenesisState(params Params, swapped Swapped) *GenesisState { +// DefaultGenesis returns the default Capability genesis state +func DefaultGenesis() *GenesisState { return &GenesisState{ - Params: params, - Swapped: swapped, + Swaps: []Swap{}, + SwapStats: SwapStats{}, + Swappeds: []Swapped{}, } } -// DefaultGenesis returns the default Capability genesis state -func DefaultGenesis() *GenesisState { - return NewGenesisState(DefaultParams(), DefaultSwapped()) -} +// 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 + } + } -// Validate performs basic genesis state validation returning an error upon any -// failure. -func (gs GenesisState) Validate() error { - if err := gs.Params.Validate(); err != nil { + if err := gs.SwapStats.ValidateBasic(); err != nil { return err } - if err := gs.Swapped.Validate(); 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 gs.Params.SwappableNewCoinAmount.LT(gs.Swapped.NewCoinAmount) { - return ErrExceedSwappable + + 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 index 5b76f03a14..89415e9484 100644 --- a/x/fswap/types/genesis.pb.go +++ b/x/fswap/types/genesis.pb.go @@ -25,8 +25,9 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // GenesisState defines the fswap module's genesis state. type GenesisState struct { - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` - Swapped Swapped `protobuf:"bytes,2,opt,name=swapped,proto3" json:"swapped"` + 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{} } @@ -62,18 +63,25 @@ func (m *GenesisState) XXX_DiscardUnknown() { var xxx_messageInfo_GenesisState proto.InternalMessageInfo -func (m *GenesisState) GetParams() Params { +func (m *GenesisState) GetSwaps() []Swap { if m != nil { - return m.Params + return m.Swaps } - return Params{} + return nil } -func (m *GenesisState) GetSwapped() Swapped { +func (m *GenesisState) GetSwapStats() SwapStats { if m != nil { - return m.Swapped + return m.SwapStats } - return Swapped{} + return SwapStats{} +} + +func (m *GenesisState) GetSwappeds() []Swapped { + if m != nil { + return m.Swappeds + } + return nil } func init() { @@ -83,22 +91,23 @@ func init() { func init() { proto.RegisterFile("lbm/fswap/v1/genesis.proto", fileDescriptor_94e309cb1db27661) } var fileDescriptor_94e309cb1db27661 = []byte{ - // 230 bytes of a gzipped FileDescriptorProto + // 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, 0x10, 0x19, 0x49, 0x14, 0x99, 0x82, 0xc4, 0xa2, 0xc4, 0x5c, 0xa8, 0xc1, - 0x4a, 0x95, 0x5c, 0x3c, 0xee, 0x10, 0x9b, 0x82, 0x4b, 0x12, 0x4b, 0x52, 0x85, 0x8c, 0xb8, 0xd8, - 0x20, 0xf2, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0xdc, 0x46, 0x22, 0x7a, 0xc8, 0x36, 0xeb, 0x05, 0x80, - 0xe5, 0x9c, 0x58, 0x4e, 0xdc, 0x93, 0x67, 0x08, 0x82, 0xaa, 0x14, 0x32, 0xe5, 0x62, 0x07, 0xc9, - 0x17, 0xa4, 0xa6, 0x48, 0x30, 0x81, 0x35, 0x89, 0xa2, 0x6a, 0x0a, 0x86, 0x48, 0x42, 0x75, 0xc1, - 0xd4, 0x3a, 0x79, 0x9c, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, - 0x13, 0x1e, 0xcb, 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x5e, 0x7a, - 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0xbe, 0x5b, 0x66, 0x5e, 0x71, 0x72, 0x46, - 0x66, 0xa2, 0x7e, 0x1a, 0x94, 0xa1, 0x5b, 0x9c, 0x92, 0xad, 0x5f, 0x01, 0xf5, 0x4e, 0x49, 0x65, - 0x41, 0x6a, 0x71, 0x12, 0x1b, 0xd8, 0x2f, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0xcb, 0xd0, - 0xcc, 0x0f, 0x42, 0x01, 0x00, 0x00, + 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) { @@ -121,8 +130,22 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = 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.Swapped.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.SwapStats.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -131,16 +154,20 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { } i-- dAtA[i] = 0x12 - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + 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 } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) } - i-- - dAtA[i] = 0xa return len(dAtA) - i, nil } @@ -161,10 +188,20 @@ func (m *GenesisState) Size() (n int) { } var l int _ = l - l = m.Params.Size() - n += 1 + l + sovGenesis(uint64(l)) - l = m.Swapped.Size() + 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 } @@ -205,7 +242,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Swaps", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -232,13 +269,47 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + 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 Swapped", wireType) + 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 { @@ -265,7 +336,8 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Swapped.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.Swappeds = append(m.Swappeds, Swapped{}) + if err := m.Swappeds[len(m.Swappeds)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/fswap/types/genesis_test.go b/x/fswap/types/genesis_test.go index 15394d1ac0..29308ea519 100644 --- a/x/fswap/types/genesis_test.go +++ b/x/fswap/types/genesis_test.go @@ -5,10 +5,10 @@ import ( "github.com/stretchr/testify/require" - sdk "github.com/Finschia/finschia-sdk/types" "github.com/Finschia/finschia-sdk/x/fswap/types" ) +// todo: add tests func TestGenesisStateValidate(t *testing.T) { for _, tc := range []struct { desc string @@ -20,72 +20,6 @@ func TestGenesisStateValidate(t *testing.T) { genState: types.DefaultGenesis(), valid: true, }, - { - desc: "empty genesisState", - genState: &types.GenesisState{}, - valid: false, - }, - { - desc: "empty params", - genState: &types.GenesisState{ - Swapped: types.DefaultSwapped(), - }, - valid: false, - }, - { - desc: "empty swapped", - genState: &types.GenesisState{ - Params: types.DefaultParams(), - }, - valid: false, - }, - { - desc: "empty swappableNewCoinAmount in params", - genState: &types.GenesisState{ - Params: types.Params{}, - Swapped: types.DefaultSwapped(), - }, - valid: false, - }, - { - desc: "empty oldCoin in Swapped", - genState: &types.GenesisState{ - Params: types.DefaultParams(), - Swapped: types.Swapped{ - NewCoinAmount: sdk.ZeroInt(), - }, - }, - valid: false, - }, - { - desc: "empty newCoin in Swapped", - genState: &types.GenesisState{ - Params: types.DefaultParams(), - Swapped: types.Swapped{ - OldCoinAmount: sdk.ZeroInt(), - }, - }, - valid: false, - }, - { - desc: "coinAmount is negative", - genState: &types.GenesisState{ - Params: types.DefaultParams(), - Swapped: types.Swapped{ - NewCoinAmount: sdk.ZeroInt(), - OldCoinAmount: sdk.NewInt(-1), - }, - }, - valid: false, - }, - { - desc: "swappable coin exceed", - genState: &types.GenesisState{ - Params: types.NewParams(sdk.NewInt(1000)), - Swapped: types.NewSwapped(sdk.NewInt(1000), sdk.NewInt(100000)), - }, - valid: false, - }, } { t.Run(tc.desc, func(t *testing.T) { err := tc.genState.Validate() diff --git a/x/fswap/types/keys.go b/x/fswap/types/keys.go index a13045fad7..d69f08c9e0 100644 --- a/x/fswap/types/keys.go +++ b/x/fswap/types/keys.go @@ -12,16 +12,4 @@ const ( // QuerierRoute defines the module's query routing key QuerierRoute = ModuleName - - // MemStoreKey defines the in-memory store key - MemStoreKey = "mem_fswap" -) - -var ( - ParamsKey = byte(0x00) - SwappedKey = byte(0x01) ) - -func KeyPrefix(p string) []byte { - return []byte(p) -} diff --git a/x/fswap/types/msgs.go b/x/fswap/types/msgs.go index 4f4ad81cb5..eae8c6a2c2 100644 --- a/x/fswap/types/msgs.go +++ b/x/fswap/types/msgs.go @@ -3,68 +3,77 @@ 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 = &MsgSwapRequest{} - -// NewMsgSwapRequest - construct a msg to swap amounts of old coin to new coin -// -//nolint:interfacer -func NewMsgSwapRequest(fromAddr, toAddr sdk.AccAddress, amount sdk.Coin) *MsgSwapRequest { - return &MsgSwapRequest{FromAddress: fromAddr.String(), Amount: amount} -} +var _ sdk.Msg = &MsgSwap{} // ValidateBasic Implements Msg. -func (msg MsgSwapRequest) ValidateBasic() error { - _, err := sdk.AccAddressFromBech32(msg.FromAddress) +func (m *MsgSwap) ValidateBasic() error { + _, err := sdk.AccAddressFromBech32(m.FromAddress) if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid address (%s)", err) + return sdkerrors.ErrInvalidAddress.Wrapf("Invalid address (%s)", err) + } + + if !m.FromCoinAmount.IsValid() { + return sdkerrors.ErrInvalidCoins.Wrap(m.FromCoinAmount.String()) } - if !msg.Amount.IsValid() { - return sdkerrors.Wrap(sdkerrors.ErrInvalidCoins, msg.Amount.String()) + if !m.FromCoinAmount.IsPositive() { + return sdkerrors.ErrInvalidCoins.Wrap(m.FromCoinAmount.String()) } - if !msg.Amount.IsPositive() { - return sdkerrors.Wrap(sdkerrors.ErrInvalidCoins, msg.Amount.String()) + if len(m.GetToDenom()) == 0 { + return sdkerrors.ErrInvalidRequest.Wrap("invalid denom (empty denom)") } return nil } // GetSigners Implements Msg. -func (msg MsgSwapRequest) GetSigners() []sdk.AccAddress { - from, err := sdk.AccAddressFromBech32(msg.FromAddress) +func (m *MsgSwap) GetSigners() []sdk.AccAddress { + from, err := sdk.AccAddressFromBech32(m.FromAddress) if err != nil { panic(err) } return []sdk.AccAddress{from} } -var _ sdk.Msg = &MsgSwapAllRequest{} - -// NewMsgSwapRequest - construct a msg to swap all old coin to new coin -// -//nolint:interfacer -func NewMsgSwapAllRequest(fromAddr, toAddr sdk.AccAddress) *MsgSwapAllRequest { - return &MsgSwapAllRequest{FromAddress: fromAddr.String()} +// 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 (msg MsgSwapAllRequest) ValidateBasic() error { - _, err := sdk.AccAddressFromBech32(msg.FromAddress) +func (m *MsgSwapAll) ValidateBasic() error { + _, err := sdk.AccAddressFromBech32(m.FromAddress) if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid address (%s)", err) + 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 (msg MsgSwapAllRequest) GetSigners() []sdk.AccAddress { - from, err := sdk.AccAddressFromBech32(msg.FromAddress) +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/params.go b/x/fswap/types/params.go deleted file mode 100644 index fbfedf3534..0000000000 --- a/x/fswap/types/params.go +++ /dev/null @@ -1,35 +0,0 @@ -package types - -import ( - "gopkg.in/yaml.v2" - - sdk "github.com/Finschia/finschia-sdk/types" -) - -// NewParams creates a new Params instance -func NewParams( - swappableNewCoinAmount sdk.Int, -) Params { - return Params{ - SwappableNewCoinAmount: swappableNewCoinAmount, - } -} - -// DefaultParams returns a default set of parameters -func DefaultParams() Params { - return NewParams(sdk.ZeroInt()) -} - -// Validate validates the set of params -func (p Params) Validate() error { - if err := validateCoinAmount(p.SwappableNewCoinAmount); err != nil { - return err - } - return nil -} - -// String implements the Stringer interface. -func (p Params) String() string { - out, _ := yaml.Marshal(p) - return string(out) -} diff --git a/x/fswap/types/params.pb.go b/x/fswap/types/params.pb.go deleted file mode 100644 index 8e9887228b..0000000000 --- a/x/fswap/types/params.pb.go +++ /dev/null @@ -1,317 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: lbm/fswap/v1/params.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 - -// Params defines the parameters for the module. -type Params struct { - SwappableNewCoinAmount github_com_Finschia_finschia_sdk_types.Int `protobuf:"bytes,1,opt,name=swappable_new_coin_amount,json=swappableNewCoinAmount,proto3,customtype=github.com/Finschia/finschia-sdk/types.Int" json:"swappable_new_coin_amount"` -} - -func (m *Params) Reset() { *m = Params{} } -func (*Params) ProtoMessage() {} -func (*Params) Descriptor() ([]byte, []int) { - return fileDescriptor_15e620b81032c44d, []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 init() { - proto.RegisterType((*Params)(nil), "lbm.fswap.v1.Params") -} - -func init() { proto.RegisterFile("lbm/fswap/v1/params.proto", fileDescriptor_15e620b81032c44d) } - -var fileDescriptor_15e620b81032c44d = []byte{ - // 225 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xcc, 0x49, 0xca, 0xd5, - 0x4f, 0x2b, 0x2e, 0x4f, 0x2c, 0xd0, 0x2f, 0x33, 0xd4, 0x2f, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, 0xd6, - 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0xc9, 0x49, 0xca, 0xd5, 0x03, 0x4b, 0xe9, 0x95, 0x19, - 0x4a, 0x89, 0xa4, 0xe7, 0xa7, 0xe7, 0x83, 0x25, 0xf4, 0x41, 0x2c, 0x88, 0x1a, 0xa5, 0x5a, 0x2e, - 0xb6, 0x00, 0xb0, 0x1e, 0xa1, 0x5c, 0x2e, 0x49, 0x90, 0xd2, 0x82, 0xc4, 0xa4, 0x9c, 0xd4, 0xf8, - 0xbc, 0xd4, 0xf2, 0xf8, 0xe4, 0xfc, 0xcc, 0xbc, 0xf8, 0xc4, 0xdc, 0xfc, 0xd2, 0xbc, 0x12, 0x09, - 0x46, 0x05, 0x46, 0x0d, 0x4e, 0x27, 0xa3, 0x13, 0xf7, 0xe4, 0x19, 0x6e, 0xdd, 0x93, 0xd7, 0x4a, - 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x77, 0xcb, 0xcc, 0x2b, 0x4e, 0xce, - 0xc8, 0x4c, 0xd4, 0x4f, 0x83, 0x32, 0x74, 0x8b, 0x53, 0xb2, 0xf5, 0x4b, 0x2a, 0x0b, 0x52, 0x8b, - 0xf5, 0x3c, 0xf3, 0x4a, 0x82, 0xc4, 0xe0, 0x86, 0xfa, 0xa5, 0x96, 0x3b, 0xe7, 0x67, 0xe6, 0x39, - 0x82, 0x4d, 0xb4, 0x62, 0x99, 0xb1, 0x40, 0x9e, 0xc1, 0xc9, 0xe3, 0xc4, 0x23, 0x39, 0xc6, 0x0b, - 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x9c, 0xf0, 0x58, 0x8e, 0xe1, 0xc2, 0x63, 0x39, 0x86, - 0x1b, 0x8f, 0xe5, 0x18, 0xa2, 0xf4, 0x08, 0xda, 0x51, 0x01, 0xf5, 0x36, 0xd8, 0xae, 0x24, 0x36, - 0xb0, 0x7f, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x53, 0xb6, 0x13, 0xee, 0x10, 0x01, 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 - { - size := m.SwappableNewCoinAmount.Size() - i -= size - if _, err := m.SwappableNewCoinAmount.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintParams(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func encodeVarintParams(dAtA []byte, offset int, v uint64) int { - offset -= sovParams(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.SwappableNewCoinAmount.Size() - n += 1 + l + sovParams(uint64(l)) - return n -} - -func sovParams(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozParams(x uint64) (n int) { - return sovParams(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 ErrIntOverflowParams - } - 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 SwappableNewCoinAmount", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowParams - } - 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 ErrInvalidLengthParams - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthParams - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.SwappableNewCoinAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipParams(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthParams - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipParams(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, ErrIntOverflowParams - } - 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, ErrIntOverflowParams - } - 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, ErrIntOverflowParams - } - 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, ErrInvalidLengthParams - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupParams - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthParams - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthParams = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowParams = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupParams = fmt.Errorf("proto: unexpected end of group") -) 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 index 67643e704b..80beb5195a 100644 --- a/x/fswap/types/query.pb.go +++ b/x/fswap/types/query.pb.go @@ -7,6 +7,7 @@ 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" @@ -31,6 +32,8 @@ var _ = math.Inf 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{} } @@ -66,9 +69,23 @@ func (m *QuerySwappedRequest) XXX_DiscardUnknown() { 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 { - OldCoin types.Coin `protobuf:"bytes,1,opt,name=old_coin,json=oldCoin,proto3,castrepeated=github.com/Finschia/finschia-sdk/types.Coin" json:"old_coin"` - NewCoin types.Coin `protobuf:"bytes,2,opt,name=new_coin,json=newCoin,proto3,castrepeated=github.com/Finschia/finschia-sdk/types.Coin" json:"new_coin"` + 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{} } @@ -104,35 +121,39 @@ func (m *QuerySwappedResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QuerySwappedResponse proto.InternalMessageInfo -func (m *QuerySwappedResponse) GetOldCoin() types.Coin { +func (m *QuerySwappedResponse) GetFromCoinAmount() types.Coin { if m != nil { - return m.OldCoin + return m.FromCoinAmount } return types.Coin{} } -func (m *QuerySwappedResponse) GetNewCoin() types.Coin { +func (m *QuerySwappedResponse) GetToCoinAmount() types.Coin { if m != nil { - return m.NewCoin + return m.ToCoinAmount } return types.Coin{} } -type QueryTotalSwappableAmountRequest struct { +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 *QueryTotalSwappableAmountRequest) Reset() { *m = QueryTotalSwappableAmountRequest{} } -func (m *QueryTotalSwappableAmountRequest) String() string { return proto.CompactTextString(m) } -func (*QueryTotalSwappableAmountRequest) ProtoMessage() {} -func (*QueryTotalSwappableAmountRequest) Descriptor() ([]byte, []int) { +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 *QueryTotalSwappableAmountRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryTotalSwappableToCoinAmountRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryTotalSwappableAmountRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryTotalSwappableToCoinAmountRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryTotalSwappableAmountRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryTotalSwappableToCoinAmountRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -142,34 +163,50 @@ func (m *QueryTotalSwappableAmountRequest) XXX_Marshal(b []byte, deterministic b return b[:n], nil } } -func (m *QueryTotalSwappableAmountRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryTotalSwappableAmountRequest.Merge(m, src) +func (m *QueryTotalSwappableToCoinAmountRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTotalSwappableToCoinAmountRequest.Merge(m, src) } -func (m *QueryTotalSwappableAmountRequest) XXX_Size() int { +func (m *QueryTotalSwappableToCoinAmountRequest) XXX_Size() int { return m.Size() } -func (m *QueryTotalSwappableAmountRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryTotalSwappableAmountRequest.DiscardUnknown(m) +func (m *QueryTotalSwappableToCoinAmountRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTotalSwappableToCoinAmountRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryTotalSwappableAmountRequest proto.InternalMessageInfo +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 QueryTotalSwappableAmountResponse struct { - SwappableNewCoin types.Coin `protobuf:"bytes,1,opt,name=swappable_new_coin,json=swappableNewCoin,proto3,castrepeated=github.com/Finschia/finschia-sdk/types.Coin" json:"swappable_new_coin"` +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 *QueryTotalSwappableAmountResponse) Reset() { *m = QueryTotalSwappableAmountResponse{} } -func (m *QueryTotalSwappableAmountResponse) String() string { return proto.CompactTextString(m) } -func (*QueryTotalSwappableAmountResponse) ProtoMessage() {} -func (*QueryTotalSwappableAmountResponse) Descriptor() ([]byte, []int) { +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 *QueryTotalSwappableAmountResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryTotalSwappableToCoinAmountResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryTotalSwappableAmountResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryTotalSwappableToCoinAmountResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryTotalSwappableAmountResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryTotalSwappableToCoinAmountResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -179,65 +216,171 @@ func (m *QueryTotalSwappableAmountResponse) XXX_Marshal(b []byte, deterministic return b[:n], nil } } -func (m *QueryTotalSwappableAmountResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryTotalSwappableAmountResponse.Merge(m, src) +func (m *QueryTotalSwappableToCoinAmountResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTotalSwappableToCoinAmountResponse.Merge(m, src) } -func (m *QueryTotalSwappableAmountResponse) XXX_Size() int { +func (m *QueryTotalSwappableToCoinAmountResponse) XXX_Size() int { return m.Size() } -func (m *QueryTotalSwappableAmountResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryTotalSwappableAmountResponse.DiscardUnknown(m) +func (m *QueryTotalSwappableToCoinAmountResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTotalSwappableToCoinAmountResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryTotalSwappableAmountResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryTotalSwappableToCoinAmountResponse proto.InternalMessageInfo -func (m *QueryTotalSwappableAmountResponse) GetSwappableNewCoin() types.Coin { +func (m *QueryTotalSwappableToCoinAmountResponse) GetSwappableAmount() types.Coin { if m != nil { - return m.SwappableNewCoin + 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((*QueryTotalSwappableAmountRequest)(nil), "lbm.fswap.v1.QueryTotalSwappableAmountRequest") - proto.RegisterType((*QueryTotalSwappableAmountResponse)(nil), "lbm.fswap.v1.QueryTotalSwappableAmountResponse") + 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{ - // 449 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x93, 0xc1, 0x6a, 0xd4, 0x40, - 0x18, 0xc7, 0x33, 0x0b, 0x5a, 0x19, 0x3d, 0xc8, 0xd8, 0x62, 0x1b, 0x34, 0x6d, 0x73, 0x51, 0x11, - 0x67, 0x48, 0xfb, 0x04, 0x56, 0x10, 0x0f, 0x22, 0x58, 0x3d, 0x79, 0x59, 0x26, 0xc9, 0x34, 0x1d, - 0x4c, 0xe6, 0x4b, 0x33, 0x93, 0x8d, 0x05, 0x4f, 0x3e, 0x81, 0xe0, 0x13, 0x78, 0x13, 0xc1, 0xf7, - 0xe8, 0xb1, 0xe0, 0xc5, 0x93, 0xca, 0xae, 0x47, 0x1f, 0x42, 0x66, 0x32, 0x5d, 0x0c, 0x2c, 0xab, - 0x97, 0xbd, 0x7d, 0xe4, 0xfb, 0x66, 0x7e, 0xff, 0xef, 0xff, 0x9f, 0xe0, 0xcd, 0x32, 0xad, 0xd8, - 0x91, 0xee, 0x78, 0xcd, 0x26, 0x09, 0x3b, 0x69, 0x45, 0x73, 0x4a, 0xeb, 0x06, 0x0c, 0x90, 0x6b, - 0x65, 0x5a, 0x51, 0xd7, 0xa1, 0x93, 0x24, 0xbc, 0x55, 0x00, 0x14, 0xa5, 0x60, 0xbc, 0x96, 0x8c, - 0x2b, 0x05, 0x86, 0x1b, 0x09, 0x4a, 0xf7, 0xb3, 0xe1, 0x7a, 0x01, 0x05, 0xb8, 0x92, 0xd9, 0xca, - 0x7f, 0x8d, 0x32, 0xd0, 0x15, 0x68, 0x96, 0x72, 0x2d, 0xd8, 0x24, 0x49, 0x85, 0xe1, 0x09, 0xcb, - 0x40, 0x2a, 0xdf, 0x1f, 0xb2, 0x7b, 0x94, 0xeb, 0xc4, 0x1b, 0xf8, 0xc6, 0x73, 0x2b, 0xe5, 0x45, - 0xc7, 0xeb, 0x5a, 0xe4, 0x87, 0xe2, 0xa4, 0x15, 0xda, 0xc4, 0xbf, 0x11, 0x5e, 0x1f, 0x7e, 0xd7, - 0x35, 0x28, 0x2d, 0x88, 0xc4, 0x57, 0xa0, 0xcc, 0xc7, 0xf6, 0xee, 0x4d, 0xb4, 0x83, 0xee, 0x5e, - 0xdd, 0xdb, 0xa2, 0x3d, 0x9c, 0x5a, 0x38, 0xf5, 0x70, 0xfa, 0x08, 0xa4, 0x3a, 0xd8, 0x3f, 0xfb, - 0xbe, 0x1d, 0x7c, 0xfe, 0xb1, 0x7d, 0xbf, 0x90, 0xe6, 0xb8, 0x4d, 0x69, 0x06, 0x15, 0x7b, 0x2c, - 0x95, 0xce, 0x8e, 0x25, 0x67, 0x47, 0xbe, 0x78, 0xa0, 0xf3, 0xd7, 0xcc, 0x9c, 0xd6, 0x42, 0xbb, - 0x43, 0x87, 0x6b, 0x50, 0xe6, 0xb6, 0xb0, 0x28, 0x25, 0xba, 0x1e, 0x35, 0x5a, 0x0d, 0x4a, 0x89, - 0xce, 0x16, 0x71, 0x8c, 0x77, 0xdc, 0xb6, 0x2f, 0xc1, 0xf0, 0xd2, 0xad, 0xcc, 0xd3, 0x52, 0x3c, - 0xac, 0xa0, 0x55, 0xe6, 0xc2, 0x92, 0x8f, 0x08, 0xef, 0x2e, 0x19, 0xf2, 0xfe, 0xbc, 0xc5, 0x44, - 0x5f, 0xb4, 0xc6, 0x73, 0xf9, 0xab, 0x71, 0xea, 0xfa, 0x9c, 0xf4, 0xac, 0xdf, 0x63, 0xef, 0xd3, - 0x08, 0x5f, 0x72, 0x1a, 0x09, 0xe0, 0x35, 0x1f, 0x1d, 0xd9, 0xa5, 0x7f, 0xbf, 0x2f, 0xba, 0x20, - 0xee, 0x30, 0x5e, 0x36, 0xd2, 0x6f, 0x16, 0xdf, 0x7e, 0xf7, 0xf5, 0xd7, 0x87, 0xd1, 0x4d, 0xb2, - 0xc1, 0x06, 0x8f, 0x49, 0x7b, 0xca, 0x17, 0x84, 0xb7, 0x9c, 0x33, 0x56, 0x4b, 0xdb, 0x34, 0x42, - 0x65, 0xee, 0x8a, 0xa7, 0xb2, 0x92, 0x86, 0xd0, 0x05, 0x80, 0x25, 0x66, 0x87, 0xec, 0xbf, 0xe7, - 0xbd, 0x3a, 0xe6, 0xd4, 0xdd, 0x23, 0x77, 0x16, 0xa8, 0x1b, 0x64, 0x31, 0xe6, 0xee, 0xe0, 0xc1, - 0x93, 0xb3, 0x69, 0x84, 0xce, 0xa7, 0x11, 0xfa, 0x39, 0x8d, 0xd0, 0xfb, 0x59, 0x14, 0x9c, 0xcf, - 0xa2, 0xe0, 0xdb, 0x2c, 0x0a, 0x5e, 0xd1, 0x7f, 0x66, 0xf0, 0xc6, 0x03, 0x5c, 0x16, 0xe9, 0x65, - 0xf7, 0x27, 0xed, 0xff, 0x09, 0x00, 0x00, 0xff, 0xff, 0x91, 0x66, 0x98, 0xa4, 0xe1, 0x03, 0x00, - 0x00, + // 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. @@ -252,8 +395,13 @@ const _ = grpc.SupportPackageIsVersion4 // // 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) - TotalNewCurrencySwapLimit(ctx context.Context, in *QueryTotalSwappableAmountRequest, opts ...grpc.CallOption) (*QueryTotalSwappableAmountResponse, 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 { @@ -273,9 +421,18 @@ func (c *queryClient) Swapped(ctx context.Context, in *QuerySwappedRequest, opts return out, nil } -func (c *queryClient) TotalNewCurrencySwapLimit(ctx context.Context, in *QueryTotalSwappableAmountRequest, opts ...grpc.CallOption) (*QueryTotalSwappableAmountResponse, error) { - out := new(QueryTotalSwappableAmountResponse) - err := c.cc.Invoke(ctx, "/lbm.fswap.v1.Query/TotalNewCurrencySwapLimit", in, out, opts...) +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 } @@ -284,8 +441,13 @@ func (c *queryClient) TotalNewCurrencySwapLimit(ctx context.Context, in *QueryTo // 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) - TotalNewCurrencySwapLimit(context.Context, *QueryTotalSwappableAmountRequest) (*QueryTotalSwappableAmountResponse, 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. @@ -295,8 +457,11 @@ 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) TotalNewCurrencySwapLimit(ctx context.Context, req *QueryTotalSwappableAmountRequest) (*QueryTotalSwappableAmountResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method TotalNewCurrencySwapLimit 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) { @@ -321,20 +486,38 @@ func _Query_Swapped_Handler(srv interface{}, ctx context.Context, dec func(inter return interceptor(ctx, in, info, handler) } -func _Query_TotalNewCurrencySwapLimit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryTotalSwappableAmountRequest) +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).TotalNewCurrencySwapLimit(ctx, in) + return srv.(QueryServer).Swaps(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/lbm.fswap.v1.Query/TotalNewCurrencySwapLimit", + FullMethod: "/lbm.fswap.v1.Query/Swaps", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).TotalNewCurrencySwapLimit(ctx, req.(*QueryTotalSwappableAmountRequest)) + return srv.(QueryServer).Swaps(ctx, req.(*QuerySwapsRequest)) } return interceptor(ctx, in, info, handler) } @@ -348,8 +531,12 @@ var _Query_serviceDesc = grpc.ServiceDesc{ Handler: _Query_Swapped_Handler, }, { - MethodName: "TotalNewCurrencySwapLimit", - Handler: _Query_TotalNewCurrencySwapLimit_Handler, + MethodName: "TotalSwappableToCoinAmount", + Handler: _Query_TotalSwappableToCoinAmount_Handler, + }, + { + MethodName: "Swaps", + Handler: _Query_Swaps_Handler, }, }, Streams: []grpc.StreamDesc{}, @@ -376,6 +563,20 @@ func (m *QuerySwappedRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = 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 } @@ -400,7 +601,7 @@ func (m *QuerySwappedResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { var l int _ = l { - size, err := m.NewCoin.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.ToCoinAmount.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -410,7 +611,7 @@ func (m *QuerySwappedResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x12 { - size, err := m.OldCoin.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.FromCoinAmount.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -422,7 +623,7 @@ func (m *QuerySwappedResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *QueryTotalSwappableAmountRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryTotalSwappableToCoinAmountRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -432,20 +633,34 @@ func (m *QueryTotalSwappableAmountRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryTotalSwappableAmountRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryTotalSwappableToCoinAmountRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryTotalSwappableAmountRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +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 *QueryTotalSwappableAmountResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryTotalSwappableToCoinAmountResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -455,18 +670,18 @@ func (m *QueryTotalSwappableAmountResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryTotalSwappableAmountResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryTotalSwappableToCoinAmountResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryTotalSwappableAmountResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryTotalSwappableToCoinAmountResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l { - size, err := m.SwappableNewCoin.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.SwappableAmount.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -478,6 +693,90 @@ func (m *QueryTotalSwappableAmountResponse) MarshalToSizedBuffer(dAtA []byte) (i 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 @@ -495,6 +794,14 @@ func (m *QuerySwappedRequest) Size() (n int) { } 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 } @@ -504,33 +811,73 @@ func (m *QuerySwappedResponse) Size() (n int) { } var l int _ = l - l = m.OldCoin.Size() + l = m.FromCoinAmount.Size() n += 1 + l + sovQuery(uint64(l)) - l = m.NewCoin.Size() + l = m.ToCoinAmount.Size() n += 1 + l + sovQuery(uint64(l)) return n } -func (m *QueryTotalSwappableAmountRequest) Size() (n int) { +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 *QueryTotalSwappableAmountResponse) Size() (n int) { +func (m *QueryTotalSwappableToCoinAmountResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = m.SwappableNewCoin.Size() + 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 } @@ -566,6 +913,70 @@ func (m *QuerySwappedRequest) Unmarshal(dAtA []byte) error { 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:]) @@ -618,7 +1029,40 @@ func (m *QuerySwappedResponse) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OldCoin", wireType) + 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 { @@ -645,13 +1089,177 @@ func (m *QuerySwappedResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.OldCoin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + 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 NewCoin", wireType) + 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 { @@ -678,7 +1286,7 @@ func (m *QuerySwappedResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.NewCoin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.SwappableAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -703,7 +1311,7 @@ func (m *QuerySwappedResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryTotalSwappableAmountRequest) Unmarshal(dAtA []byte) error { +func (m *QuerySwapsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -726,12 +1334,48 @@ func (m *QueryTotalSwappableAmountRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryTotalSwappableAmountRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QuerySwapsRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryTotalSwappableAmountRequest: illegal tag %d (wire type %d)", fieldNum, wire) + 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:]) @@ -753,7 +1397,7 @@ func (m *QueryTotalSwappableAmountRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryTotalSwappableAmountResponse) Unmarshal(dAtA []byte) error { +func (m *QuerySwapsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -776,15 +1420,49 @@ func (m *QueryTotalSwappableAmountResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryTotalSwappableAmountResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QuerySwapsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryTotalSwappableAmountResponse: illegal tag %d (wire type %d)", fieldNum, wire) + 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 SwappableNewCoin", wireType) + 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 { @@ -811,7 +1489,10 @@ func (m *QueryTotalSwappableAmountResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.SwappableNewCoin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/fswap/types/query.pb.gw.go b/x/fswap/types/query.pb.gw.go index 5a63817f6a..00786290bd 100644 --- a/x/fswap/types/query.pb.gw.go +++ b/x/fswap/types/query.pb.gw.go @@ -31,10 +31,21 @@ 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 @@ -44,25 +55,86 @@ func local_request_Query_Swapped_0(ctx context.Context, marshaler runtime.Marsha 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 } -func request_Query_TotalNewCurrencySwapLimit_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryTotalSwappableAmountRequest +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 - msg, err := client.TotalNewCurrencySwapLimit(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + 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 } -func local_request_Query_TotalNewCurrencySwapLimit_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryTotalSwappableAmountRequest +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 - msg, err := server.TotalNewCurrencySwapLimit(ctx, &protoReq) + 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 } @@ -93,7 +165,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) - mux.Handle("GET", pattern_Query_TotalNewCurrencySwapLimit_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + 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) @@ -102,14 +174,34 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_TotalNewCurrencySwapLimit_0(rctx, inboundMarshaler, server, req, pathParams) + 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_TotalNewCurrencySwapLimit_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + 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()...) }) @@ -174,7 +266,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) - mux.Handle("GET", pattern_Query_TotalNewCurrencySwapLimit_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + 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) @@ -183,14 +275,34 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_TotalNewCurrencySwapLimit_0(rctx, inboundMarshaler, client, req, pathParams) + 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_TotalNewCurrencySwapLimit_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + 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()...) }) @@ -200,11 +312,15 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie 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_TotalNewCurrencySwapLimit_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"lbm", "fswap", "v1", "swappable_new_coin_amount"}, "", 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_TotalNewCurrencySwapLimit_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 index 682ec7260b..288ada4778 100644 --- a/x/fswap/types/tx.pb.go +++ b/x/fswap/types/tx.pb.go @@ -29,25 +29,26 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -type MsgSwapRequest struct { +type MsgSwap struct { // holder's address FromAddress string `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3" json:"from_address,omitempty"` - // amount of old currency - Amount types.Coin `protobuf:"bytes,2,opt,name=amount,proto3,castrepeated=github.com/Finschia/finschia-sdk/types.Coin" json:"amount"` + // 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 *MsgSwapRequest) Reset() { *m = MsgSwapRequest{} } -func (m *MsgSwapRequest) String() string { return proto.CompactTextString(m) } -func (*MsgSwapRequest) ProtoMessage() {} -func (*MsgSwapRequest) Descriptor() ([]byte, []int) { +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 *MsgSwapRequest) XXX_Unmarshal(b []byte) error { +func (m *MsgSwap) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgSwapRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgSwap) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgSwapRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgSwap.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -57,32 +58,39 @@ func (m *MsgSwapRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, erro return b[:n], nil } } -func (m *MsgSwapRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgSwapRequest.Merge(m, src) +func (m *MsgSwap) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSwap.Merge(m, src) } -func (m *MsgSwapRequest) XXX_Size() int { +func (m *MsgSwap) XXX_Size() int { return m.Size() } -func (m *MsgSwapRequest) XXX_DiscardUnknown() { - xxx_messageInfo_MsgSwapRequest.DiscardUnknown(m) +func (m *MsgSwap) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSwap.DiscardUnknown(m) } -var xxx_messageInfo_MsgSwapRequest proto.InternalMessageInfo +var xxx_messageInfo_MsgSwap proto.InternalMessageInfo -func (m *MsgSwapRequest) GetFromAddress() string { +func (m *MsgSwap) GetFromAddress() string { if m != nil { return m.FromAddress } return "" } -func (m *MsgSwapRequest) GetAmount() types.Coin { +func (m *MsgSwap) GetFromCoinAmount() types.Coin { if m != nil { - return m.Amount + return m.FromCoinAmount } return types.Coin{} } +func (m *MsgSwap) GetToDenom() string { + if m != nil { + return m.ToDenom + } + return "" +} + type MsgSwapResponse struct { } @@ -119,23 +127,25 @@ func (m *MsgSwapResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgSwapResponse proto.InternalMessageInfo -type MsgSwapAllRequest struct { +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 *MsgSwapAllRequest) Reset() { *m = MsgSwapAllRequest{} } -func (m *MsgSwapAllRequest) String() string { return proto.CompactTextString(m) } -func (*MsgSwapAllRequest) ProtoMessage() {} -func (*MsgSwapAllRequest) Descriptor() ([]byte, []int) { +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 *MsgSwapAllRequest) XXX_Unmarshal(b []byte) error { +func (m *MsgSwapAll) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgSwapAllRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgSwapAll) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgSwapAllRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgSwapAll.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -145,25 +155,39 @@ func (m *MsgSwapAllRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, e return b[:n], nil } } -func (m *MsgSwapAllRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgSwapAllRequest.Merge(m, src) +func (m *MsgSwapAll) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSwapAll.Merge(m, src) } -func (m *MsgSwapAllRequest) XXX_Size() int { +func (m *MsgSwapAll) XXX_Size() int { return m.Size() } -func (m *MsgSwapAllRequest) XXX_DiscardUnknown() { - xxx_messageInfo_MsgSwapAllRequest.DiscardUnknown(m) +func (m *MsgSwapAll) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSwapAll.DiscardUnknown(m) } -var xxx_messageInfo_MsgSwapAllRequest proto.InternalMessageInfo +var xxx_messageInfo_MsgSwapAll proto.InternalMessageInfo -func (m *MsgSwapAllRequest) GetFromAddress() string { +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 { } @@ -201,38 +225,41 @@ func (m *MsgSwapAllResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgSwapAllResponse proto.InternalMessageInfo func init() { - proto.RegisterType((*MsgSwapRequest)(nil), "lbm.fswap.v1.MsgSwapRequest") + proto.RegisterType((*MsgSwap)(nil), "lbm.fswap.v1.MsgSwap") proto.RegisterType((*MsgSwapResponse)(nil), "lbm.fswap.v1.MsgSwapResponse") - proto.RegisterType((*MsgSwapAllRequest)(nil), "lbm.fswap.v1.MsgSwapAllRequest") + 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{ - // 348 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x52, 0xcd, 0x4a, 0xf3, 0x40, - 0x14, 0xcd, 0x7c, 0x9f, 0x54, 0x9c, 0x16, 0xa5, 0x43, 0x85, 0x1a, 0x34, 0xad, 0x59, 0x15, 0xc4, - 0x19, 0xd2, 0x82, 0xfb, 0xb6, 0x20, 0x2e, 0xec, 0xa6, 0xee, 0xdc, 0x48, 0x92, 0x4e, 0xd2, 0x60, - 0x92, 0x89, 0xbd, 0xd3, 0x1f, 0xdf, 0xc2, 0xa5, 0xe0, 0x1b, 0xf8, 0x24, 0x5d, 0x76, 0xe9, 0x4a, - 0xa5, 0x7d, 0x11, 0x49, 0x26, 0x68, 0x05, 0x8b, 0xee, 0x2e, 0xe7, 0xdc, 0x7b, 0xce, 0xe1, 0xcc, - 0xe0, 0xfd, 0xd0, 0x89, 0x98, 0x07, 0x53, 0x3b, 0x61, 0x13, 0x8b, 0xc9, 0x19, 0x4d, 0x46, 0x42, - 0x0a, 0x52, 0x0a, 0x9d, 0x88, 0x66, 0x30, 0x9d, 0x58, 0x7a, 0xc5, 0x17, 0xbe, 0xc8, 0x08, 0x96, - 0x4e, 0x6a, 0x47, 0x37, 0x5c, 0x01, 0x91, 0x00, 0xe6, 0xd8, 0xc0, 0xd9, 0xc4, 0x72, 0xb8, 0xb4, - 0x2d, 0xe6, 0x8a, 0x20, 0x56, 0xbc, 0xf9, 0x84, 0xf0, 0x6e, 0x0f, 0xfc, 0xab, 0xa9, 0x9d, 0xf4, - 0xf9, 0xdd, 0x98, 0x83, 0x24, 0xc7, 0xb8, 0xe4, 0x8d, 0x44, 0x74, 0x63, 0x0f, 0x06, 0x23, 0x0e, - 0x50, 0x45, 0x75, 0xd4, 0xd8, 0xe9, 0x17, 0x53, 0xac, 0xad, 0x20, 0xe2, 0xe1, 0x82, 0x1d, 0x89, - 0x71, 0x2c, 0xab, 0xff, 0xea, 0xa8, 0x51, 0x6c, 0x1e, 0x50, 0x65, 0x43, 0x53, 0x1b, 0x9a, 0xdb, - 0xd0, 0xae, 0x08, 0xe2, 0x4e, 0x6b, 0xfe, 0x5a, 0xd3, 0x9e, 0xdf, 0x6a, 0x27, 0x7e, 0x20, 0x87, - 0x63, 0x87, 0xba, 0x22, 0x62, 0xe7, 0x41, 0x0c, 0xee, 0x30, 0xb0, 0x99, 0x97, 0x0f, 0xa7, 0x30, - 0xb8, 0x65, 0xf2, 0x3e, 0xe1, 0x90, 0x1d, 0xf5, 0x73, 0x75, 0xb3, 0x8c, 0xf7, 0x3e, 0xc3, 0x41, - 0x22, 0x62, 0xe0, 0xe6, 0x19, 0x2e, 0xe7, 0x50, 0x3b, 0x0c, 0xff, 0x1e, 0xd9, 0xac, 0x60, 0xb2, - 0x7e, 0xa7, 0xd4, 0x9a, 0x8f, 0x08, 0xff, 0xef, 0x81, 0x4f, 0xba, 0x78, 0x2b, 0xa5, 0xc8, 0x21, - 0x5d, 0xef, 0x94, 0x7e, 0x6f, 0x46, 0x3f, 0xda, 0xc0, 0x2a, 0x31, 0x72, 0x89, 0xb7, 0x73, 0x7d, - 0x52, 0xfb, 0x71, 0xf3, 0x2b, 0xb1, 0x5e, 0xdf, 0xbc, 0xa0, 0xd4, 0x3a, 0x17, 0xf3, 0xa5, 0x81, - 0x16, 0x4b, 0x03, 0xbd, 0x2f, 0x0d, 0xf4, 0xb0, 0x32, 0xb4, 0xc5, 0xca, 0xd0, 0x5e, 0x56, 0x86, - 0x76, 0x4d, 0x7f, 0xad, 0x72, 0x96, 0xff, 0x96, 0xac, 0x52, 0xa7, 0x90, 0x3d, 0x75, 0xeb, 0x23, - 0x00, 0x00, 0xff, 0xff, 0xf1, 0x37, 0x1c, 0xc2, 0x47, 0x02, 0x00, 0x00, + // 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. @@ -247,8 +274,8 @@ const _ = grpc.SupportPackageIsVersion4 // // 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 *MsgSwapRequest, opts ...grpc.CallOption) (*MsgSwapResponse, error) - SwapAll(ctx context.Context, in *MsgSwapAllRequest, opts ...grpc.CallOption) (*MsgSwapAllResponse, error) + 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 { @@ -259,7 +286,7 @@ func NewMsgClient(cc grpc1.ClientConn) MsgClient { return &msgClient{cc} } -func (c *msgClient) Swap(ctx context.Context, in *MsgSwapRequest, opts ...grpc.CallOption) (*MsgSwapResponse, error) { +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 { @@ -268,7 +295,7 @@ func (c *msgClient) Swap(ctx context.Context, in *MsgSwapRequest, opts ...grpc.C return out, nil } -func (c *msgClient) SwapAll(ctx context.Context, in *MsgSwapAllRequest, opts ...grpc.CallOption) (*MsgSwapAllResponse, error) { +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 { @@ -279,18 +306,18 @@ func (c *msgClient) SwapAll(ctx context.Context, in *MsgSwapAllRequest, opts ... // MsgServer is the server API for Msg service. type MsgServer interface { - Swap(context.Context, *MsgSwapRequest) (*MsgSwapResponse, error) - SwapAll(context.Context, *MsgSwapAllRequest) (*MsgSwapAllResponse, error) + 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 *MsgSwapRequest) (*MsgSwapResponse, error) { +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 *MsgSwapAllRequest) (*MsgSwapAllResponse, error) { +func (*UnimplementedMsgServer) SwapAll(ctx context.Context, req *MsgSwapAll) (*MsgSwapAllResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method SwapAll not implemented") } @@ -299,7 +326,7 @@ func RegisterMsgServer(s grpc1.Server, srv MsgServer) { } func _Msg_Swap_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgSwapRequest) + in := new(MsgSwap) if err := dec(in); err != nil { return nil, err } @@ -311,13 +338,13 @@ func _Msg_Swap_Handler(srv interface{}, ctx context.Context, dec func(interface{ FullMethod: "/lbm.fswap.v1.Msg/Swap", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).Swap(ctx, req.(*MsgSwapRequest)) + 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(MsgSwapAllRequest) + in := new(MsgSwapAll) if err := dec(in); err != nil { return nil, err } @@ -329,7 +356,7 @@ func _Msg_SwapAll_Handler(srv interface{}, ctx context.Context, dec func(interfa FullMethod: "/lbm.fswap.v1.Msg/SwapAll", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).SwapAll(ctx, req.(*MsgSwapAllRequest)) + return srv.(MsgServer).SwapAll(ctx, req.(*MsgSwapAll)) } return interceptor(ctx, in, info, handler) } @@ -351,7 +378,7 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ Metadata: "lbm/fswap/v1/tx.proto", } -func (m *MsgSwapRequest) Marshal() (dAtA []byte, err error) { +func (m *MsgSwap) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -361,18 +388,25 @@ func (m *MsgSwapRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgSwapRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgSwap) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgSwapRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +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.Amount.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.FromCoinAmount.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -414,7 +448,7 @@ func (m *MsgSwapResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *MsgSwapAllRequest) Marshal() (dAtA []byte, err error) { +func (m *MsgSwapAll) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -424,16 +458,30 @@ func (m *MsgSwapAllRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgSwapAllRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgSwapAll) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgSwapAllRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +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) @@ -478,7 +526,7 @@ func encodeVarintTx(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *MsgSwapRequest) Size() (n int) { +func (m *MsgSwap) Size() (n int) { if m == nil { return 0 } @@ -488,8 +536,12 @@ func (m *MsgSwapRequest) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = m.Amount.Size() + 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 } @@ -502,7 +554,7 @@ func (m *MsgSwapResponse) Size() (n int) { return n } -func (m *MsgSwapAllRequest) Size() (n int) { +func (m *MsgSwapAll) Size() (n int) { if m == nil { return 0 } @@ -512,6 +564,14 @@ func (m *MsgSwapAllRequest) Size() (n int) { 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 } @@ -530,7 +590,7 @@ func sovTx(x uint64) (n int) { func sozTx(x uint64) (n int) { return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *MsgSwapRequest) Unmarshal(dAtA []byte) error { +func (m *MsgSwap) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -553,10 +613,10 @@ func (m *MsgSwapRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgSwapRequest: wiretype end group for non-group") + return fmt.Errorf("proto: MsgSwap: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgSwapRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgSwap: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -593,7 +653,7 @@ func (m *MsgSwapRequest) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field FromCoinAmount", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -620,10 +680,42 @@ func (m *MsgSwapRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + 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:]) @@ -695,7 +787,7 @@ func (m *MsgSwapResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgSwapAllRequest) Unmarshal(dAtA []byte) error { +func (m *MsgSwapAll) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -718,10 +810,10 @@ func (m *MsgSwapAllRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgSwapAllRequest: wiretype end group for non-group") + return fmt.Errorf("proto: MsgSwapAll: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgSwapAllRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgSwapAll: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -756,6 +848,70 @@ func (m *MsgSwapAllRequest) Unmarshal(dAtA []byte) error { } 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:]) diff --git a/x/fswap/types/types.go b/x/fswap/types/types.go deleted file mode 100644 index ab1254f4c2..0000000000 --- a/x/fswap/types/types.go +++ /dev/null @@ -1 +0,0 @@ -package types From 28f5fa3d861d8113bd6917d3863e9a7421b15463 Mon Sep 17 00:00:00 2001 From: Jaeseung Lee <41176085+tkxkd0159@users.noreply.github.com> Date: Tue, 7 May 2024 20:49:01 +0900 Subject: [PATCH 7/7] feat: add role-based access control for bridge (#1350) * add submitting role proposal feature * feat: addVote * feat: role proposal confirmation logic * add gRPC for RBAC * fix checking trustLevel condition * validate role metadata during initialization * add invariants for metadata * delete expired proposal at begin blocker * add memStore and halting feature * remove redundant gRPC queries * fix endblock logic * add Params test * add dummy guardian for testing * remove redundant invariants * set bridge switch at missing parts * add gov authority * add guardian invariant * add single member query * return error if the address has no role * append genesis validation * add CLI * return all registered members if there is no query string * add unit tests for RBAC * merge `halt` with `resume` as `set-bridge-status` * Add CHANGELOG * add ERRORS docs * apply 0tech review * enhance bridge switch unit test * maintain bridge status metadata based on permanent states * change panic msg for unimplemented features * check duplicate seq in genesis * bridge inactive counter must always be initialization * bridge is always inactive if there is no guardian * start fbridge module after auth/bank * remove redundant invariant checking --- CHANGELOG.md | 1 + client/docs/config.json | 9 +- client/docs/swagger-ui/swagger.yaml | 992 ++++++++---- docs/core/proto-docs.md | 520 +++++-- proto/lbm/fbridge/v1/event.proto | 16 + proto/lbm/fbridge/v1/fbridge.proto | 69 +- proto/lbm/fbridge/v1/genesis.proto | 16 + proto/lbm/fbridge/v1/query.proto | 96 +- proto/lbm/fbridge/v1/tx.proto | 26 +- simapp/app.go | 6 +- x/ERRORS.md | 12 + x/fbridge/client/cli/query.go | 234 ++- x/fbridge/client/cli/tx.go | 130 +- x/fbridge/keeper/abci.go | 65 + x/fbridge/keeper/auth.go | 331 ++++ x/fbridge/keeper/auth_test.go | 89 ++ x/fbridge/keeper/genesis.go | 58 + x/fbridge/keeper/grpc_query.go | 137 +- x/fbridge/keeper/keeper.go | 122 +- x/fbridge/keeper/msg_server.go | 87 +- x/fbridge/keeper/params.go | 24 + x/fbridge/keeper/transfer_test.go | 7 +- x/fbridge/module/module.go | 24 +- x/fbridge/testutil/setup.go | 18 +- x/fbridge/types/codec.go | 6 +- x/fbridge/types/errors.go | 9 + x/fbridge/types/event.pb.go | 468 +++++- x/fbridge/types/fbridge.go | 39 + x/fbridge/types/fbridge.pb.go | 1145 ++++++++++++-- x/fbridge/types/genesis.go | 88 +- x/fbridge/types/genesis.pb.go | 589 +++++++- x/fbridge/types/keys.go | 88 +- x/fbridge/types/msgs.go | 19 +- x/fbridge/types/params.go | 64 + x/fbridge/types/params_test.go | 62 + x/fbridge/types/query.pb.go | 2161 +++++++++++++++++++-------- x/fbridge/types/query.pb.gw.go | 402 ++++- x/fbridge/types/tx.pb.go | 579 ++----- 38 files changed, 6931 insertions(+), 1877 deletions(-) create mode 100644 x/fbridge/keeper/abci.go create mode 100644 x/fbridge/keeper/auth.go create mode 100644 x/fbridge/keeper/auth_test.go create mode 100644 x/fbridge/keeper/params.go create mode 100644 x/fbridge/types/errors.go create mode 100644 x/fbridge/types/fbridge.go create mode 100644 x/fbridge/types/params_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e2c15134a..317a2b61fe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,6 +46,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (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) +* (x/fbridge) [\#1350](https://github.com/Finschia/finschia-sdk/pull/1350) Add Role-based Access Control ### Improvements * (docs) [\#1120](https://github.com/Finschia/finschia-sdk/pull/1120) Update links in x/foundation README.md diff --git a/client/docs/config.json b/client/docs/config.json index 4a1968c6ee..6670e56370 100644 --- a/client/docs/config.json +++ b/client/docs/config.json @@ -171,11 +171,12 @@ "rename": { "Params": "FBridgeParams", "Commitments": "FBridgeCommitments", - "Guardians": "FBridgeGuardians", - "Operators": "FBridgeOperators", - "Judges": "FBridgeJudges", + "Members": "FBridgeMembers", + "Member": "FBridgeMember", "Proposals": "FBridgeProposals", - "Proposal": "FBridgeProposal" + "Proposal": "FBridgeProposal", + "Votes": "FBridgeVotes", + "Vote": "FBridgeVote" } } } diff --git a/client/docs/swagger-ui/swagger.yaml b/client/docs/swagger-ui/swagger.yaml index 30b1c66412..de9fab3eff 100644 --- a/client/docs/swagger-ui/swagger.yaml +++ b/client/docs/swagger-ui/swagger.yaml @@ -29799,17 +29799,17 @@ paths: format: byte tags: - Service - /lbm/fbridge/v1/guardians: + /lbm/fbridge/v1/members: get: - summary: Guardians queries a list of Guardians registered on the bridge - operationId: FBridgeGuardians + summary: Members queries the members of spcific group registered on the bridge + operationId: FBridgeMembers responses: '200': description: A successful response. schema: type: object properties: - guardians: + members: type: array items: type: string @@ -29835,60 +29835,26 @@ paths: value: type: string format: byte + parameters: + - name: role + description: 'the role name (guardian, operator, judge).' + in: query + required: false + type: string tags: - Query - /lbm/fbridge/v1/judges: + '/lbm/fbridge/v1/members/{address}': get: - summary: Judges queries a list of Judges registered on the bridge - operationId: FBridgeJudges + summary: Member queries the role of a specific member + operationId: FBridgeMember responses: '200': description: A successful response. schema: type: object properties: - judges: - type: array - items: - type: string - default: - description: An unexpected error response - schema: - type: object - properties: - error: - type: string - code: - type: integer - format: int32 - message: + role: type: string - details: - type: array - items: - type: object - properties: - type_url: - type: string - value: - type: string - format: byte - tags: - - Query - /lbm/fbridge/v1/operators: - get: - summary: Operators queries a list of Operators registered on the bridge - operationId: FBridgeOperators - responses: - '200': - description: A successful response. - schema: - type: object - properties: - operators: - type: array - items: - type: string default: description: An unexpected error response schema: @@ -29911,6 +29877,11 @@ paths: value: type: string format: byte + parameters: + - name: address + in: path + required: true + type: string tags: - Query /lbm/fbridge/v1/params: @@ -29996,6 +29967,371 @@ paths: format: byte tags: - Query + /lbm/fbridge/v1/proposals: + get: + summary: Proposals queries a list of SuggestRole Proposals + operationId: FBridgeProposals + responses: + '200': + description: A successful response. + schema: + type: object + properties: + proposals: + type: array + items: + type: object + properties: + id: + type: string + format: uint64 + proposer: + type: string + title: the proposer address + target: + type: string + title: the address to update the role + role: + title: >- + the role to be updated + + - unspecified : 0, used to remove the address from a + group + + - guardian : 1 + + - operator : 2 + + - judge : 3 + type: string + enum: + - UNSPECIFIED + - GUARDIAN + - OPERATOR + - JUDGE + default: UNSPECIFIED + description: >- + Role defines the role of the operator, guardian, and + judge. + expired_at: + type: string + format: date-time + title: >- + the unix timestamp the proposal will be expired (unix + timestamp) + pagination: + description: pagination defines an pagination for the response. + type: object + properties: + next_key: + type: string + format: byte + title: |- + next_key is the key to be passed to PageRequest.key to + query the next page most efficiently + total: + type: string + format: uint64 + title: >- + total is total number of results available if + PageRequest.count_total + + was set, its value is undefined otherwise + default: + description: An unexpected error response + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + parameters: + - name: pagination.key + description: |- + key is a value returned in PageResponse.next_key to begin + querying the next page most efficiently. Only one of offset or key + should be set. + in: query + required: false + type: string + format: byte + - name: pagination.offset + description: >- + offset is a numeric offset that can be used when key is unavailable. + + It is less efficient than using key. Only one of offset or key + should + + be set. + in: query + required: false + type: string + format: uint64 + - name: pagination.limit + description: >- + limit is the total number of results to be returned in the result + page. + + If left empty it will default to a value to be set by each app. + in: query + required: false + type: string + format: uint64 + - name: pagination.count_total + description: >- + count_total is set to true to indicate that the result set should + include + + a count of the total number of items available for pagination in + UIs. + + count_total is only respected when offset is used. It is ignored + when key + + is set. + in: query + required: false + type: boolean + format: boolean + - name: pagination.reverse + description: >- + reverse is set to true if results are to be returned in the + descending order. + + + Since: cosmos-sdk 0.43 + in: query + required: false + type: boolean + format: boolean + tags: + - Query + '/lbm/fbridge/v1/proposals/{proposal_id}': + get: + summary: Proposal queries a SuggestRole Proposal + operationId: FBridgeProposal + responses: + '200': + description: A successful response. + schema: + type: object + properties: + proposal: + type: object + properties: + id: + type: string + format: uint64 + proposer: + type: string + title: the proposer address + target: + type: string + title: the address to update the role + role: + title: |- + the role to be updated + - unspecified : 0, used to remove the address from a group + - guardian : 1 + - operator : 2 + - judge : 3 + type: string + enum: + - UNSPECIFIED + - GUARDIAN + - OPERATOR + - JUDGE + default: UNSPECIFIED + description: >- + Role defines the role of the operator, guardian, and + judge. + expired_at: + type: string + format: date-time + title: >- + the unix timestamp the proposal will be expired (unix + timestamp) + default: + description: An unexpected error response + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + parameters: + - name: proposal_id + description: the proposal id + in: path + required: true + type: string + format: uint64 + tags: + - Query + '/lbm/fbridge/v1/proposals/{proposal_id}/votes': + get: + summary: Votes queries votes of a given proposal. + operationId: FBridgeVotes + responses: + '200': + description: A successful response. + schema: + type: object + properties: + votes: + type: array + items: + type: object + properties: + proposal_id: + type: string + format: uint64 + voter: + type: string + option: + type: string + enum: + - VOTE_OPTION_UNSPECIFIED + - VOTE_OPTION_YES + - VOTE_OPTION_NO + default: VOTE_OPTION_UNSPECIFIED + description: >- + VoteOption enumerates the valid vote options for a given + role proposal. + + - VOTE_OPTION_UNSPECIFIED: VOTE_OPTION_UNSPECIFIED defines a no-op vote option. + - VOTE_OPTION_YES: VOTE_OPTION_YES defines a yes vote option. + - VOTE_OPTION_NO: VOTE_OPTION_NO defines a no vote option. + description: Vote defines a vote on a role proposal. + description: votes defined the queried votes. + default: + description: An unexpected error response + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + parameters: + - name: proposal_id + description: proposal_id defines the unique id of the proposal. + in: path + required: true + type: string + format: uint64 + tags: + - Query + '/lbm/fbridge/v1/proposals/{proposal_id}/votes/{voter}': + get: + summary: 'Vote queries voted information based on proposalID, voterAddr.' + operationId: FBridgeVote + responses: + '200': + description: A successful response. + schema: + type: object + properties: + vote: + type: object + properties: + proposal_id: + type: string + format: uint64 + voter: + type: string + option: + type: string + enum: + - VOTE_OPTION_UNSPECIFIED + - VOTE_OPTION_YES + - VOTE_OPTION_NO + default: VOTE_OPTION_UNSPECIFIED + description: >- + VoteOption enumerates the valid vote options for a given + role proposal. + + - VOTE_OPTION_UNSPECIFIED: VOTE_OPTION_UNSPECIFIED defines a no-op vote option. + - VOTE_OPTION_YES: VOTE_OPTION_YES defines a yes vote option. + - VOTE_OPTION_NO: VOTE_OPTION_NO defines a no vote option. + description: Vote defines a vote on a role proposal. + default: + description: An unexpected error response + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + parameters: + - name: proposal_id + description: proposal_id defines the unique id of the proposal. + in: path + required: true + type: string + format: uint64 + - name: voter + description: voter defines the oter address for the proposals. + in: path + required: true + type: string + tags: + - Query '/lbm/fbridge/v1/receiving/commitments/{seq}': get: summary: Commitments queries commitments of a specific sequence number @@ -30258,287 +30594,76 @@ paths: format: int32 message: type: string - details: - type: array - items: - type: object - properties: - type_url: - type: string - value: - type: string - format: byte - parameters: - - name: operator - description: the address of the operator - in: path - required: true - type: string - tags: - - Query - '/lbm/fbridge/v1/receiving/provision/{seq}': - get: - summary: ConfirmedProvision queries a particular sequence of confirmed provisions - operationId: ConfirmedProvision - responses: - '200': - description: A successful response. - schema: - type: object - properties: - data: - type: object - properties: - seq: - type: string - format: uint64 - title: the sequence number of the bridge request - amount: - type: string - title: the amount of token to be claimed - sender: - type: string - title: the sender address on the source chain - receiver: - type: string - title: the recipient address on the destination chain - description: Provision is a struct that represents a provision internally. - status: - type: object - properties: - timelock_end: - type: string - format: uint64 - title: >- - the unix timestamp the provision will be able to be - claimed (unix timestamp) - confirm_counts: - type: integer - format: int32 - title: >- - a value that tells how many operators have submitted this - provision - is_claimed: - type: boolean - format: boolean - title: whether the provision has been claimed - description: >- - ProvisionStatus is a struct that represents the status of a - provision. - - To optimize computational cost, we have collected frequently - changing values from provision. - default: - description: An unexpected error response - schema: - type: object - properties: - error: - type: string - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - type_url: - type: string - value: - type: string - format: byte - parameters: - - name: seq - description: the sequence number of the bridge request - in: path - required: true - type: string - format: uint64 - tags: - - Query - /lbm/fbridge/v1/role/proposals: - get: - summary: Proposals queries a list of SuggestRole Proposals - operationId: FBridgeProposals - responses: - '200': - description: A successful response. - schema: - type: object - properties: - proposals: - type: array - items: - type: object - properties: - id: - type: string - format: uint64 - proposer: - type: string - title: the proposer address - target: - type: string - title: the address to update the role - role: - title: >- - the role to be updated - - - unspecified : 0, used to remove the address from a - group - - - guardian : 1 - - - operator : 2 - - - judge : 3 - type: string - enum: - - UNSPECIFIED - - GUARDIAN - - OPERATOR - - JUDGE - default: UNSPECIFIED - description: >- - Role defines the role of the operator, guardian, and - judge. - expired_at: - type: string - format: uint64 - title: >- - the unix timestamp the proposal will be expired (unix - timestamp) - default: - description: An unexpected error response - schema: - type: object - properties: - error: - type: string - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - type_url: - type: string - value: - type: string - format: byte - parameters: - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - format: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - format: boolean + details: + type: array + items: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + parameters: + - name: operator + description: the address of the operator + in: path + required: true + type: string tags: - Query - '/lbm/fbridge/v1/role/proposals/{proposal_id}': + '/lbm/fbridge/v1/receiving/provision/{seq}': get: - summary: Proposal queries a SuggestRole Proposal - operationId: FBridgeProposal + summary: ConfirmedProvision queries a particular sequence of confirmed provisions + operationId: ConfirmedProvision responses: '200': description: A successful response. schema: type: object properties: - proposal: + data: type: object properties: - id: + seq: type: string format: uint64 - proposer: + title: the sequence number of the bridge request + amount: type: string - title: the proposer address - target: + title: the amount of token to be claimed + sender: type: string - title: the address to update the role - role: - title: |- - the role to be updated - - unspecified : 0, used to remove the address from a group - - guardian : 1 - - operator : 2 - - judge : 3 + title: the sender address on the source chain + receiver: type: string - enum: - - UNSPECIFIED - - GUARDIAN - - OPERATOR - - JUDGE - default: UNSPECIFIED - description: >- - Role defines the role of the operator, guardian, and - judge. - expired_at: + title: the recipient address on the destination chain + description: Provision is a struct that represents a provision internally. + status: + type: object + properties: + timelock_end: type: string format: uint64 title: >- - the unix timestamp the proposal will be expired (unix - timestamp) + the unix timestamp the provision will be able to be + claimed (unix timestamp) + confirm_counts: + type: integer + format: int32 + title: >- + a value that tells how many operators have submitted this + provision + is_claimed: + type: boolean + format: boolean + title: whether the provision has been claimed + description: >- + ProvisionStatus is a struct that represents the status of a + provision. + + To optimize computational cost, we have collected frequently + changing values from provision. default: description: An unexpected error response schema: @@ -30562,11 +30687,12 @@ paths: type: string format: byte parameters: - - name: proposal_id - description: the proposal id + - name: seq + description: the sequence number of the bridge request in: path required: true type: string + format: uint64 tags: - Query /lbm/fbridge/v1/sending/blocknums: @@ -30657,6 +30783,65 @@ paths: format: byte tags: - Query + /lbm/fbridge/v1/status: + get: + summary: BridgeStatus queries the status of the bridge + operationId: BridgeStatus + responses: + '200': + description: A successful response. + schema: + type: object + properties: + status: + type: string + enum: + - BRIDGE_STATUS_UNSPECIFIED + - BRIDGE_STATUS_ACTIVE + - BRIDGE_STATUS_INACTIVE + default: BRIDGE_STATUS_UNSPECIFIED + description: |2- + - BRIDGE_STATUS_UNSPECIFIED: BRIDGE_STATUS_UNSPECIFIED defines an unspecified bridge status. + - BRIDGE_STATUS_ACTIVE: BRIDGE_STATUS_ACTIVE defines an active bridge status. + - BRIDGE_STATUS_INACTIVE: BRIDGE_STATUS_INACTIVE defines an inactive bridge status. + metadata: + type: object + properties: + inactive: + type: string + format: uint64 + title: the number of inactived bridge switch + active: + type: string + format: uint64 + title: the number of activated bridge switch + description: >- + BridgeStatusMetadata defines the metadata of the bridge + status. + default: + description: An unexpected error response + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + tags: + - Query definitions: cosmos.auth.v1beta1.Params: type: object @@ -50202,6 +50387,29 @@ definitions: minimum_gas_price: type: string description: ConfigResponse defines the response structure for the Config gRPC query. + lbm.fbridge.v1.BridgeStatus: + type: string + enum: + - BRIDGE_STATUS_UNSPECIFIED + - BRIDGE_STATUS_ACTIVE + - BRIDGE_STATUS_INACTIVE + default: BRIDGE_STATUS_UNSPECIFIED + description: |2- + - BRIDGE_STATUS_UNSPECIFIED: BRIDGE_STATUS_UNSPECIFIED defines an unspecified bridge status. + - BRIDGE_STATUS_ACTIVE: BRIDGE_STATUS_ACTIVE defines an active bridge status. + - BRIDGE_STATUS_INACTIVE: BRIDGE_STATUS_INACTIVE defines an inactive bridge status. + lbm.fbridge.v1.BridgeStatusMetadata: + type: object + properties: + inactive: + type: string + format: uint64 + title: the number of inactived bridge switch + active: + type: string + format: uint64 + title: the number of activated bridge switch + description: BridgeStatusMetadata defines the metadata of the bridge status. lbm.fbridge.v1.Fraction: type: object properties: @@ -50294,6 +50502,32 @@ definitions: To optimize computational cost, we have collected frequently changing values from provision. + lbm.fbridge.v1.QueryBridgeStatusResponse: + type: object + properties: + status: + type: string + enum: + - BRIDGE_STATUS_UNSPECIFIED + - BRIDGE_STATUS_ACTIVE + - BRIDGE_STATUS_INACTIVE + default: BRIDGE_STATUS_UNSPECIFIED + description: |2- + - BRIDGE_STATUS_UNSPECIFIED: BRIDGE_STATUS_UNSPECIFIED defines an unspecified bridge status. + - BRIDGE_STATUS_ACTIVE: BRIDGE_STATUS_ACTIVE defines an active bridge status. + - BRIDGE_STATUS_INACTIVE: BRIDGE_STATUS_INACTIVE defines an inactive bridge status. + metadata: + type: object + properties: + inactive: + type: string + format: uint64 + title: the number of inactived bridge switch + active: + type: string + format: uint64 + title: the number of activated bridge switch + description: BridgeStatusMetadata defines the metadata of the bridge status. lbm.fbridge.v1.QueryCommitmentsResponse: type: object properties: @@ -50357,17 +50591,15 @@ definitions: seq: type: string format: uint64 - lbm.fbridge.v1.QueryGuardiansResponse: + lbm.fbridge.v1.QueryMemberResponse: type: object properties: - guardians: - type: array - items: - type: string - lbm.fbridge.v1.QueryJudgesResponse: + role: + type: string + lbm.fbridge.v1.QueryMembersResponse: type: object properties: - judges: + members: type: array items: type: string @@ -50385,13 +50617,6 @@ definitions: seq: type: string format: uint64 - lbm.fbridge.v1.QueryOperatorsResponse: - type: object - properties: - operators: - type: array - items: - type: string lbm.fbridge.v1.QueryParamsResponse: type: object properties: @@ -50468,7 +50693,7 @@ definitions: description: 'Role defines the role of the operator, guardian, and judge.' expired_at: type: string - format: uint64 + format: date-time title: the unix timestamp the proposal will be expired (unix timestamp) lbm.fbridge.v1.QueryProposalsResponse: type: object @@ -50504,8 +50729,26 @@ definitions: description: 'Role defines the role of the operator, guardian, and judge.' expired_at: type: string - format: uint64 + format: date-time title: the unix timestamp the proposal will be expired (unix timestamp) + pagination: + description: pagination defines an pagination for the response. + type: object + properties: + next_key: + type: string + format: byte + title: |- + next_key is the key to be passed to PageRequest.key to + query the next page most efficiently + total: + type: string + format: uint64 + title: >- + total is total number of results available if + PageRequest.count_total + + was set, its value is undefined otherwise lbm.fbridge.v1.QuerySeqToBlocknumsResponse: type: object properties: @@ -50558,6 +50801,61 @@ definitions: To optimize computational cost, we have collected frequently changing values from provision. + lbm.fbridge.v1.QueryVoteResponse: + type: object + properties: + vote: + type: object + properties: + proposal_id: + type: string + format: uint64 + voter: + type: string + option: + type: string + enum: + - VOTE_OPTION_UNSPECIFIED + - VOTE_OPTION_YES + - VOTE_OPTION_NO + default: VOTE_OPTION_UNSPECIFIED + description: >- + VoteOption enumerates the valid vote options for a given role + proposal. + + - VOTE_OPTION_UNSPECIFIED: VOTE_OPTION_UNSPECIFIED defines a no-op vote option. + - VOTE_OPTION_YES: VOTE_OPTION_YES defines a yes vote option. + - VOTE_OPTION_NO: VOTE_OPTION_NO defines a no vote option. + description: Vote defines a vote on a role proposal. + lbm.fbridge.v1.QueryVotesResponse: + type: object + properties: + votes: + type: array + items: + type: object + properties: + proposal_id: + type: string + format: uint64 + voter: + type: string + option: + type: string + enum: + - VOTE_OPTION_UNSPECIFIED + - VOTE_OPTION_YES + - VOTE_OPTION_NO + default: VOTE_OPTION_UNSPECIFIED + description: >- + VoteOption enumerates the valid vote options for a given role + proposal. + + - VOTE_OPTION_UNSPECIFIED: VOTE_OPTION_UNSPECIFIED defines a no-op vote option. + - VOTE_OPTION_YES: VOTE_OPTION_YES defines a yes vote option. + - VOTE_OPTION_NO: VOTE_OPTION_NO defines a no vote option. + description: Vote defines a vote on a role proposal. + description: votes defined the queried votes. lbm.fbridge.v1.Role: type: string enum: @@ -50596,5 +50894,41 @@ definitions: description: 'Role defines the role of the operator, guardian, and judge.' expired_at: type: string - format: uint64 + format: date-time title: the unix timestamp the proposal will be expired (unix timestamp) + lbm.fbridge.v1.Vote: + type: object + properties: + proposal_id: + type: string + format: uint64 + voter: + type: string + option: + type: string + enum: + - VOTE_OPTION_UNSPECIFIED + - VOTE_OPTION_YES + - VOTE_OPTION_NO + default: VOTE_OPTION_UNSPECIFIED + description: >- + VoteOption enumerates the valid vote options for a given role + proposal. + + - VOTE_OPTION_UNSPECIFIED: VOTE_OPTION_UNSPECIFIED defines a no-op vote option. + - VOTE_OPTION_YES: VOTE_OPTION_YES defines a yes vote option. + - VOTE_OPTION_NO: VOTE_OPTION_NO defines a no vote option. + description: Vote defines a vote on a role proposal. + lbm.fbridge.v1.VoteOption: + type: string + enum: + - VOTE_OPTION_UNSPECIFIED + - VOTE_OPTION_YES + - VOTE_OPTION_NO + default: VOTE_OPTION_UNSPECIFIED + description: |- + VoteOption enumerates the valid vote options for a given role proposal. + + - VOTE_OPTION_UNSPECIFIED: VOTE_OPTION_UNSPECIFIED defines a no-op vote option. + - VOTE_OPTION_YES: VOTE_OPTION_YES defines a yes vote option. + - VOTE_OPTION_NO: VOTE_OPTION_NO defines a no vote option. diff --git a/docs/core/proto-docs.md b/docs/core/proto-docs.md index 56d2cf5fd1..379b2d65ea 100644 --- a/docs/core/proto-docs.md +++ b/docs/core/proto-docs.md @@ -754,23 +754,32 @@ - [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) + - [BridgeStatusMetadata](#lbm.fbridge.v1.BridgeStatusMetadata) - [Fraction](#lbm.fbridge.v1.Fraction) - [Params](#lbm.fbridge.v1.Params) - [ProvisionData](#lbm.fbridge.v1.ProvisionData) - [ProvisionStatus](#lbm.fbridge.v1.ProvisionStatus) + - [RoleMetadata](#lbm.fbridge.v1.RoleMetadata) + - [RolePair](#lbm.fbridge.v1.RolePair) - [RoleProposal](#lbm.fbridge.v1.RoleProposal) + - [Vote](#lbm.fbridge.v1.Vote) + - [BridgeStatus](#lbm.fbridge.v1.BridgeStatus) - [Role](#lbm.fbridge.v1.Role) + - [VoteOption](#lbm.fbridge.v1.VoteOption) + +- [lbm/fbridge/v1/event.proto](#lbm/fbridge/v1/event.proto) + - [EventAddVoteForRole](#lbm.fbridge.v1.EventAddVoteForRole) + - [EventClaim](#lbm.fbridge.v1.EventClaim) + - [EventConfirmProvision](#lbm.fbridge.v1.EventConfirmProvision) + - [EventProvision](#lbm.fbridge.v1.EventProvision) + - [EventSuggestRole](#lbm.fbridge.v1.EventSuggestRole) + - [EventTransfer](#lbm.fbridge.v1.EventTransfer) - [lbm/fbridge/v1/genesis.proto](#lbm/fbridge/v1/genesis.proto) - [BlockSeqInfo](#lbm.fbridge.v1.BlockSeqInfo) + - [BridgeSwitch](#lbm.fbridge.v1.BridgeSwitch) - [Commitment](#lbm.fbridge.v1.Commitment) - [ConfirmedProvision](#lbm.fbridge.v1.ConfirmedProvision) - [GenesisState](#lbm.fbridge.v1.GenesisState) @@ -780,6 +789,8 @@ - [SendingState](#lbm.fbridge.v1.SendingState) - [lbm/fbridge/v1/query.proto](#lbm/fbridge/v1/query.proto) + - [QueryBridgeStatusRequest](#lbm.fbridge.v1.QueryBridgeStatusRequest) + - [QueryBridgeStatusResponse](#lbm.fbridge.v1.QueryBridgeStatusResponse) - [QueryCommitmentsRequest](#lbm.fbridge.v1.QueryCommitmentsRequest) - [QueryCommitmentsResponse](#lbm.fbridge.v1.QueryCommitmentsResponse) - [QueryConfirmedProvisionRequest](#lbm.fbridge.v1.QueryConfirmedProvisionRequest) @@ -788,16 +799,14 @@ - [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) + - [QueryMemberRequest](#lbm.fbridge.v1.QueryMemberRequest) + - [QueryMemberResponse](#lbm.fbridge.v1.QueryMemberResponse) + - [QueryMembersRequest](#lbm.fbridge.v1.QueryMembersRequest) + - [QueryMembersResponse](#lbm.fbridge.v1.QueryMembersResponse) - [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) @@ -808,6 +817,10 @@ - [QuerySeqToBlocknumsResponse](#lbm.fbridge.v1.QuerySeqToBlocknumsResponse) - [QuerySubmittedProvisionRequest](#lbm.fbridge.v1.QuerySubmittedProvisionRequest) - [QuerySubmittedProvisionResponse](#lbm.fbridge.v1.QuerySubmittedProvisionResponse) + - [QueryVoteRequest](#lbm.fbridge.v1.QueryVoteRequest) + - [QueryVoteResponse](#lbm.fbridge.v1.QueryVoteResponse) + - [QueryVotesRequest](#lbm.fbridge.v1.QueryVotesRequest) + - [QueryVotesResponse](#lbm.fbridge.v1.QueryVotesResponse) - [Query](#lbm.fbridge.v1.Query) @@ -818,8 +831,6 @@ - [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) @@ -828,8 +839,8 @@ - [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) + - [MsgSetBridgeStatus](#lbm.fbridge.v1.MsgSetBridgeStatus) + - [MsgSetBridgeStatusResponse](#lbm.fbridge.v1.MsgSetBridgeStatusResponse) - [MsgSuggestRole](#lbm.fbridge.v1.MsgSuggestRole) - [MsgSuggestRoleResponse](#lbm.fbridge.v1.MsgSuggestRoleResponse) - [MsgTransfer](#lbm.fbridge.v1.MsgTransfer) @@ -11385,77 +11396,164 @@ Msg defines the collection Msg service. - +

Top

-## lbm/fbridge/v1/event.proto +## lbm/fbridge/v1/fbridge.proto - + -### EventClaim +### BridgeStatusMetadata +BridgeStatusMetadata defines the metadata of the bridge status. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `inactive` | [uint64](#uint64) | | the number of inactived bridge switch | +| `active` | [uint64](#uint64) | | the number of activated bridge switch | + + + + + + + + +### Fraction +Fraction defines the protobuf message type for tmmath.Fraction that only +supports positive values. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `numerator` | [uint64](#uint64) | | | +| `denominator` | [uint64](#uint64) | | | + + + + + + + + +### Params +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `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 | + + + + + + + + +### ProvisionData +Provision is a struct that represents a provision internally. + + | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | `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 | -| `amount` | [string](#string) | | the amount of token to be claimed | - + + +### 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 | +| ----- | ---- | ----- | ----------- | +| `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 | + -### EventConfirmProvision + + + +### RoleMetadata +RoleMetadata defines the metadata of the role. + + | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `seq` | [uint64](#uint64) | | the sequence number of the bridge request | +| `guardian` | [uint64](#uint64) | | the number of registered guardians | +| `operator` | [uint64](#uint64) | | the number of the operators | +| `judge` | [uint64](#uint64) | | the number of the judges | - + -### EventProvision +### RolePair | 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 | -| `operator` | [string](#string) | | the address of the operator | +| `address` | [string](#string) | | | +| `role` | [Role](#lbm.fbridge.v1.Role) | | | - + -### EventTransfer +### RoleProposal | 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 transferred | +| `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` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | the unix timestamp the proposal will be expired (unix timestamp) | + + + + + + + + +### Vote +Vote defines a vote on a role proposal. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `proposal_id` | [uint64](#uint64) | | | +| `voter` | [string](#string) | | | +| `option` | [VoteOption](#lbm.fbridge.v1.VoteOption) | | | @@ -11463,6 +11561,46 @@ Msg defines the collection Msg service. + + + +### BridgeStatus + + +| Name | Number | Description | +| ---- | ------ | ----------- | +| BRIDGE_STATUS_UNSPECIFIED | 0 | BRIDGE_STATUS_UNSPECIFIED defines an unspecified bridge status. | +| BRIDGE_STATUS_ACTIVE | 1 | BRIDGE_STATUS_ACTIVE defines an active bridge status. | +| BRIDGE_STATUS_INACTIVE | 2 | BRIDGE_STATUS_INACTIVE defines an inactive bridge status. | + + + + + +### Role +Role defines the role of the operator, guardian, and judge. + +| Name | Number | Description | +| ---- | ------ | ----------- | +| UNSPECIFIED | 0 | | +| GUARDIAN | 1 | | +| OPERATOR | 2 | | +| JUDGE | 3 | | + + + + + +### VoteOption +VoteOption enumerates the valid vote options for a given role 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_NO | 2 | VOTE_OPTION_NO defines a no vote option. | + + @@ -11471,119 +11609,116 @@ Msg defines the collection Msg service. - +

Top

-## lbm/fbridge/v1/fbridge.proto +## lbm/fbridge/v1/event.proto - + + +### EventAddVoteForRole -### Fraction -Fraction defines the protobuf message type for tmmath.Fraction that only -supports positive values. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `numerator` | [uint64](#uint64) | | | -| `denominator` | [uint64](#uint64) | | | +| `voter` | [string](#string) | | the voter address | +| `proposal_id` | [uint64](#uint64) | | the role proposal id | +| `option` | [VoteOption](#lbm.fbridge.v1.VoteOption) | | the vote option | - + -### Params +### EventClaim | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `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 | +| `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 -### ProvisionData -Provision is a struct that represents a provision internally. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | `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 | - + + +### EventProvision -### 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 | | ----- | ---- | ----- | ----------- | -| `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 | +| `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 | - + -### RoleProposal +### EventSuggestRole | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `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) | +| `proposal` | [RoleProposal](#lbm.fbridge.v1.RoleProposal) | | | - + - +### EventTransfer + + + +| 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 transferred | -### Role -Role defines the role of the operator, guardian, and judge. -| Name | Number | Description | -| ---- | ------ | ----------- | -| UNSPECIFIED | 0 | | -| GUARDIAN | 1 | | -| OPERATOR | 2 | | -| JUDGE | 3 | | + + + @@ -11615,6 +11750,22 @@ Role defines the role of the operator, guardian, and judge. + + +### BridgeSwitch + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `guardian` | [string](#string) | | the guardian address | +| `status` | [BridgeStatus](#lbm.fbridge.v1.BridgeStatus) | | | + + + + + + ### Commitment @@ -11659,6 +11810,11 @@ GenesisState defines the fbridge module's genesis state. | `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 | +| `next_role_proposal_id` | [uint64](#uint64) | | next_role_proposal_id is the next role proposal ID to be used. | +| `role_proposals` | [RoleProposal](#lbm.fbridge.v1.RoleProposal) | repeated | role_proposals defines all the role proposals present at genesis. | +| `votes` | [Vote](#lbm.fbridge.v1.Vote) | repeated | votes defines all the votes present for role proposals at genesis. | +| `roles` | [RolePair](#lbm.fbridge.v1.RolePair) | repeated | roles defines all addresses assigned roles at genesis. | +| `bridge_switches` | [BridgeSwitch](#lbm.fbridge.v1.BridgeSwitch) | repeated | bridge_switches defines the status of whether each guardian has allowed the bridge to operate. | @@ -11751,6 +11907,32 @@ GenesisState defines the fbridge module's genesis state. + + +### QueryBridgeStatusRequest + + + + + + + + + +### QueryBridgeStatusResponse + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `status` | [BridgeStatus](#lbm.fbridge.v1.BridgeStatus) | | | +| `metadata` | [BridgeStatusMetadata](#lbm.fbridge.v1.BridgeStatusMetadata) | | | + + + + + + ### QueryCommitmentsRequest @@ -11867,50 +12049,60 @@ GenesisState defines the fbridge module's genesis state. - + + +### QueryMemberRequest -### QueryGuardiansRequest +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `address` | [string](#string) | | | - -### QueryGuardiansResponse + + +### QueryMemberResponse | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `guardians` | [string](#string) | repeated | | +| `role` | [string](#string) | | | + + - +### QueryMembersRequest -### QueryJudgesRequest +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `role` | [string](#string) | | the role name (guardian, operator, judge) | - -### QueryJudgesResponse + + +### QueryMembersResponse | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `judges` | [string](#string) | repeated | | +| `members` | [string](#string) | repeated | | @@ -11973,31 +12165,6 @@ GenesisState defines the fbridge module's genesis state. - - -### QueryOperatorsRequest - - - - - - - - - -### QueryOperatorsResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `operators` | [string](#string) | repeated | | - - - - - - ### QueryParamsRequest @@ -12031,7 +12198,7 @@ GenesisState defines the fbridge module's genesis state. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `proposal_id` | [string](#string) | | the proposal id | +| `proposal_id` | [uint64](#uint64) | | the proposal id | @@ -12077,6 +12244,7 @@ GenesisState defines the fbridge module's genesis state. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | `proposals` | [RoleProposal](#lbm.fbridge.v1.RoleProposal) | repeated | | +| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | pagination defines an pagination for the response. | @@ -12144,6 +12312,67 @@ GenesisState defines the fbridge module's genesis state. + + + +### QueryVoteRequest + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `proposal_id` | [uint64](#uint64) | | proposal_id defines the unique id of the proposal. | +| `voter` | [string](#string) | | voter defines the oter address for the proposals. | + + + + + + + + +### QueryVoteResponse + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `vote` | [Vote](#lbm.fbridge.v1.Vote) | | vote defined the queried vote. | + + + + + + + + +### QueryVotesRequest + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `proposal_id` | [uint64](#uint64) | | proposal_id defines the unique id of the proposal. | + + + + + + + + +### QueryVotesResponse + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `votes` | [Vote](#lbm.fbridge.v1.Vote) | repeated | votes defined the queried votes. | + + + + + @@ -12167,11 +12396,13 @@ GenesisState defines the fbridge module's genesis state. | `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}| +| `Members` | [QueryMembersRequest](#lbm.fbridge.v1.QueryMembersRequest) | [QueryMembersResponse](#lbm.fbridge.v1.QueryMembersResponse) | Members queries the members of spcific group registered on the bridge | GET|/lbm/fbridge/v1/members| +| `Member` | [QueryMemberRequest](#lbm.fbridge.v1.QueryMemberRequest) | [QueryMemberResponse](#lbm.fbridge.v1.QueryMemberResponse) | Member queries the role of a specific member | GET|/lbm/fbridge/v1/members/{address}| +| `Proposals` | [QueryProposalsRequest](#lbm.fbridge.v1.QueryProposalsRequest) | [QueryProposalsResponse](#lbm.fbridge.v1.QueryProposalsResponse) | Proposals queries a list of SuggestRole Proposals | GET|/lbm/fbridge/v1/proposals| +| `Proposal` | [QueryProposalRequest](#lbm.fbridge.v1.QueryProposalRequest) | [QueryProposalResponse](#lbm.fbridge.v1.QueryProposalResponse) | Proposal queries a SuggestRole Proposal | GET|/lbm/fbridge/v1/proposals/{proposal_id}| +| `Vote` | [QueryVoteRequest](#lbm.fbridge.v1.QueryVoteRequest) | [QueryVoteResponse](#lbm.fbridge.v1.QueryVoteResponse) | Vote queries voted information based on proposalID, voterAddr. | GET|/lbm/fbridge/v1/proposals/{proposal_id}/votes/{voter}| +| `Votes` | [QueryVotesRequest](#lbm.fbridge.v1.QueryVotesRequest) | [QueryVotesResponse](#lbm.fbridge.v1.QueryVotesResponse) | Votes queries votes of a given proposal. | GET|/lbm/fbridge/v1/proposals/{proposal_id}/votes| +| `BridgeStatus` | [QueryBridgeStatusRequest](#lbm.fbridge.v1.QueryBridgeStatusRequest) | [QueryBridgeStatusResponse](#lbm.fbridge.v1.QueryBridgeStatusResponse) | BridgeStatus queries the status of the bridge | GET|/lbm/fbridge/v1/status| @@ -12194,7 +12425,7 @@ GenesisState defines the fbridge module's genesis state. | ----- | ---- | ----- | ----------- | | `from` | [string](#string) | | the guardian address | | `proposal_id` | [uint64](#uint64) | | the proposal ID | -| `option` | [bool](#bool) | | the vote option - yes : true - no : false | +| `option` | [VoteOption](#lbm.fbridge.v1.VoteOption) | | the vote option | @@ -12263,31 +12494,6 @@ MsgClaimBatch is input values required for claiming multiple claimable provision - - -### MsgHalt -MsgHalt is input values required for halting the bridge module - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `guardian` | [string](#string) | | the guardian address | - - - - - - - - -### MsgHaltResponse - - - - - - - ### MsgHoldTransfer @@ -12395,24 +12601,25 @@ MsgRemoveProvision is input values required for removing a specific confirmed pr - + -### MsgResume -MsgResume is input values required for resuming the bridge module +### MsgSetBridgeStatus +MsgSetBridgeStatus is input values required for setting the status of the bridge module | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `from` | [string](#string) | | the guardian address | +| `guardian` | [string](#string) | | the guardian address | +| `status` | [BridgeStatus](#lbm.fbridge.v1.BridgeStatus) | | | - + -### MsgResumeResponse +### MsgSetBridgeStatusResponse @@ -12496,8 +12703,7 @@ MsgTransfer is input values required for bridge transfer | `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. | | +| `SetBridgeStatus` | [MsgSetBridgeStatus](#lbm.fbridge.v1.MsgSetBridgeStatus) | [MsgSetBridgeStatusResponse](#lbm.fbridge.v1.MsgSetBridgeStatusResponse) | SetBridgeStatus operates a switch to halt/resume the bridge module. If the ratio of inactive bridge switches exceed TrustLevel, the bridge module halts. | | diff --git a/proto/lbm/fbridge/v1/event.proto b/proto/lbm/fbridge/v1/event.proto index e7594d4dc8..324a2db2a2 100644 --- a/proto/lbm/fbridge/v1/event.proto +++ b/proto/lbm/fbridge/v1/event.proto @@ -3,6 +3,9 @@ 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"; + message EventTransfer { // the sequence number of the bridge request uint64 seq = 1; @@ -14,6 +17,19 @@ message EventTransfer { string amount = 4; } +message EventSuggestRole { + RoleProposal proposal = 1 [(gogoproto.nullable) = false]; +} + +message EventAddVoteForRole { + // the voter address + string voter = 1; + // the role proposal id + uint64 proposal_id = 2; + // the vote option + VoteOption option = 3; +} + message EventProvision { // the sequence number of the bridge request uint64 seq = 1; diff --git a/proto/lbm/fbridge/v1/fbridge.proto b/proto/lbm/fbridge/v1/fbridge.proto index fccbf79a22..c3c4d5b6c7 100644 --- a/proto/lbm/fbridge/v1/fbridge.proto +++ b/proto/lbm/fbridge/v1/fbridge.proto @@ -3,6 +3,7 @@ package lbm.fbridge.v1; option go_package = "github.com/Finschia/finschia-sdk/x/fbridge/types"; +import "google/protobuf/timestamp.proto"; import "gogoproto/gogo.proto"; message Params { @@ -51,10 +52,17 @@ message Fraction { // Role defines the role of the operator, guardian, and judge. enum Role { - UNSPECIFIED = 0; - GUARDIAN = 1; - OPERATOR = 2; - JUDGE = 3; + option (gogoproto.goproto_enum_prefix) = false; + + UNSPECIFIED = 0 [(gogoproto.enumvalue_customname) = "RoleEmpty"]; + GUARDIAN = 1 [(gogoproto.enumvalue_customname) = "RoleGuardian"]; + OPERATOR = 2 [(gogoproto.enumvalue_customname) = "RoleOperator"]; + JUDGE = 3 [(gogoproto.enumvalue_customname) = "RoleJudge"]; +} + +message RolePair { + string address = 1; + Role role = 2; } message RoleProposal { @@ -71,5 +79,56 @@ message RoleProposal { Role role = 4; // the unix timestamp the proposal will be expired (unix timestamp) - uint64 expired_at = 5; + google.protobuf.Timestamp expired_at = 5 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; +} + +// VoteOption enumerates the valid vote options for a given role proposal. +enum VoteOption { + option (gogoproto.goproto_enum_prefix) = false; + + // VOTE_OPTION_UNSPECIFIED defines a no-op vote option. + VOTE_OPTION_UNSPECIFIED = 0 [(gogoproto.enumvalue_customname) = "OptionEmpty"]; + // VOTE_OPTION_YES defines a yes vote option. + VOTE_OPTION_YES = 1 [(gogoproto.enumvalue_customname) = "OptionYes"]; + // VOTE_OPTION_NO defines a no vote option. + VOTE_OPTION_NO = 2 [(gogoproto.enumvalue_customname) = "OptionNo"]; +} + +// Vote defines a vote on a role proposal. +message Vote { + option (gogoproto.equal) = false; + + uint64 proposal_id = 1; + string voter = 2; + VoteOption option = 3; +} + +// RoleMetadata defines the metadata of the role. +message RoleMetadata { + // the number of registered guardians + uint64 guardian = 1; + // the number of the operators + uint64 operator = 2; + // the number of the judges + uint64 judge = 3; +} + +enum BridgeStatus { + option (gogoproto.goproto_enum_prefix) = false; + + // BRIDGE_STATUS_UNSPECIFIED defines an unspecified bridge status. + BRIDGE_STATUS_UNSPECIFIED = 0 [(gogoproto.enumvalue_customname) = "StatusEmpty"]; + + // BRIDGE_STATUS_ACTIVE defines an active bridge status. + BRIDGE_STATUS_ACTIVE = 1 [(gogoproto.enumvalue_customname) = "StatusActive"]; + // BRIDGE_STATUS_INACTIVE defines an inactive bridge status. + BRIDGE_STATUS_INACTIVE = 2 [(gogoproto.enumvalue_customname) = "StatusInactive"]; +} + +// BridgeStatusMetadata defines the metadata of the bridge status. +message BridgeStatusMetadata { + // the number of inactived bridge switch + uint64 inactive = 1; + // the number of activated bridge switch + uint64 active = 2; } diff --git a/proto/lbm/fbridge/v1/genesis.proto b/proto/lbm/fbridge/v1/genesis.proto index 35775047b2..57d5260328 100644 --- a/proto/lbm/fbridge/v1/genesis.proto +++ b/proto/lbm/fbridge/v1/genesis.proto @@ -14,6 +14,16 @@ message GenesisState { 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]; + // next_role_proposal_id is the next role proposal ID to be used. + uint64 next_role_proposal_id = 4; + // role_proposals defines all the role proposals present at genesis. + repeated RoleProposal role_proposals = 5 [(gogoproto.nullable) = false]; + // votes defines all the votes present for role proposals at genesis. + repeated Vote votes = 6 [(gogoproto.nullable) = false]; + // roles defines all addresses assigned roles at genesis. + repeated RolePair roles = 7 [(gogoproto.nullable) = false]; + // bridge_switches defines the status of whether each guardian has allowed the bridge to operate. + repeated BridgeSwitch bridge_switches = 8 [(gogoproto.nullable) = false]; } message SendingState { @@ -79,3 +89,9 @@ message ConfirmedProvision { // commitment is the hash value of a provision string commitment = 2; } + +message BridgeSwitch { + // the guardian address + string guardian = 1; + BridgeStatus status = 2; +} diff --git a/proto/lbm/fbridge/v1/query.proto b/proto/lbm/fbridge/v1/query.proto index 120039df88..b59d513956 100644 --- a/proto/lbm/fbridge/v1/query.proto +++ b/proto/lbm/fbridge/v1/query.proto @@ -58,29 +58,39 @@ service Query { 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"; + // Members queries the members of spcific group registered on the bridge + rpc Members(QueryMembersRequest) returns (QueryMembersResponse) { + option (google.api.http).get = "/lbm/fbridge/v1/members"; } - // 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"; + // Member queries the role of a specific member + rpc Member(QueryMemberRequest) returns (QueryMemberResponse) { + option (google.api.http).get = "/lbm/fbridge/v1/members/{address}"; } // Proposals queries a list of SuggestRole Proposals rpc Proposals(QueryProposalsRequest) returns (QueryProposalsResponse) { - option (google.api.http).get = "/lbm/fbridge/v1/role/proposals"; + option (google.api.http).get = "/lbm/fbridge/v1/proposals"; } // Proposal queries a SuggestRole Proposal rpc Proposal(QueryProposalRequest) returns (QueryProposalResponse) { - option (google.api.http).get = "/lbm/fbridge/v1/role/proposals/{proposal_id}"; + option (google.api.http).get = "/lbm/fbridge/v1/proposals/{proposal_id}"; + } + + // Vote queries voted information based on proposalID, voterAddr. + rpc Vote(QueryVoteRequest) returns (QueryVoteResponse) { + option (google.api.http).get = "/lbm/fbridge/v1/proposals/{proposal_id}/votes/{voter}"; + } + + // Votes queries votes of a given proposal. + rpc Votes(QueryVotesRequest) returns (QueryVotesResponse) { + option (google.api.http).get = "/lbm/fbridge/v1/proposals/{proposal_id}/votes"; + } + + // BridgeStatus queries the status of the bridge + rpc BridgeStatus(QueryBridgeStatusRequest) returns (QueryBridgeStatusResponse) { + option (google.api.http).get = "/lbm/fbridge/v1/status"; } } @@ -162,22 +172,21 @@ message QueryCommitmentsResponse { repeated string commitments = 1; } -message QueryGuardiansRequest {} - -message QueryGuardiansResponse { - repeated string guardians = 1; +message QueryMembersRequest { + // the role name (guardian, operator, judge) + string role = 1; } -message QueryOperatorsRequest {} - -message QueryOperatorsResponse { - repeated string operators = 1; +message QueryMembersResponse { + repeated string members = 1; } -message QueryJudgesRequest {} +message QueryMemberRequest { + string address = 1; +} -message QueryJudgesResponse { - repeated string judges = 1; +message QueryMemberResponse { + string role = 1; } message QueryProposalsRequest { @@ -186,14 +195,47 @@ message QueryProposalsRequest { } message QueryProposalsResponse { - repeated RoleProposal proposals = 1; + repeated RoleProposal proposals = 1 [(gogoproto.nullable) = false]; + + // pagination defines an pagination for the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; } message QueryProposalRequest { // the proposal id - string proposal_id = 1; + uint64 proposal_id = 1; } message QueryProposalResponse { - RoleProposal proposal = 1; + RoleProposal proposal = 1 [(gogoproto.nullable) = false]; +} + +message QueryVoteRequest { + // proposal_id defines the unique id of the proposal. + uint64 proposal_id = 1; + + // voter defines the oter address for the proposals. + string voter = 2; +} + +message QueryVoteResponse { + // vote defined the queried vote. + Vote vote = 1 [(gogoproto.nullable) = false]; +} + +message QueryVotesRequest { + // proposal_id defines the unique id of the proposal. + uint64 proposal_id = 1; +} + +message QueryVotesResponse { + // votes defined the queried votes. + repeated Vote votes = 1 [(gogoproto.nullable) = false]; +} + +message QueryBridgeStatusRequest {} + +message QueryBridgeStatusResponse { + BridgeStatus status = 1; + BridgeStatusMetadata metadata = 2 [(gogoproto.nullable) = false]; } diff --git a/proto/lbm/fbridge/v1/tx.proto b/proto/lbm/fbridge/v1/tx.proto index 8b114a8645..e1186ec588 100644 --- a/proto/lbm/fbridge/v1/tx.proto +++ b/proto/lbm/fbridge/v1/tx.proto @@ -36,11 +36,9 @@ service Msg { // 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); + // SetBridgeStatus operates a switch to halt/resume the bridge module. + // If the ratio of inactive bridge switches exceed TrustLevel, the bridge module halts. + rpc SetBridgeStatus(MsgSetBridgeStatus) returns (MsgSetBridgeStatusResponse); } // MsgTransfer is input values required for bridge transfer @@ -145,25 +143,17 @@ message MsgAddVoteForRole { // the proposal ID uint64 proposal_id = 2; // the vote option - // - yes : true - // - no : false - bool option = 3; + VoteOption option = 3; } message MsgAddVoteForRoleResponse {} -// MsgHalt is input values required for halting the bridge module -message MsgHalt { +// MsgSetBridgeStatus is input values required for setting the status of the bridge module +message MsgSetBridgeStatus { // 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; + BridgeStatus status = 2; } -message MsgResumeResponse {} +message MsgSetBridgeStatusResponse {} diff --git a/simapp/app.go b/simapp/app.go index 7bb68f2e01..9b064b19b2 100644 --- a/simapp/app.go +++ b/simapp/app.go @@ -271,7 +271,7 @@ func NewSimApp( tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey) // NOTE: The testingkey is just mounted for testing purposes. Actual applications should // not include this key. - memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey, "testingkey") + memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey, fbridgetypes.MemStoreKey, "testingkey") // configure state listening capabilities using AppOptions // we are doing nothing with the returned streamingServices and waitGroup in this case @@ -373,7 +373,7 @@ 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()) + app.FbridgeKeeper = fbridgekeeper.NewKeeper(appCodec, keys[fbridgetypes.StoreKey], memKeys[fbridgetypes.MemStoreKey], app.AccountKeeper, app.BankKeeper, "stake", fbridgetypes.DefaultAuthority().String()) /**** Module Options ****/ @@ -471,6 +471,7 @@ func NewSimApp( capabilitytypes.ModuleName, authtypes.ModuleName, banktypes.ModuleName, + fbridgetypes.ModuleName, distrtypes.ModuleName, stakingtypes.ModuleName, slashingtypes.ModuleName, @@ -488,7 +489,6 @@ func NewSimApp( token.ModuleName, collection.ModuleName, fswaptypes.ModuleName, - fbridgetypes.ModuleName, ) // Uncomment if you want to set a custom migration order here. diff --git a/x/ERRORS.md b/x/ERRORS.md index dcf56afb65..d8dc1ea25e 100644 --- a/x/ERRORS.md +++ b/x/ERRORS.md @@ -7,6 +7,7 @@ * [Crisis](#crisis) * [Distribution](#distribution) * [Evidence](#evidence) + * [Fbridge](#fbridge) * [Feegrant](#feegrant) * [Foundation](#foundation) * [Fswap](#fswap) @@ -151,6 +152,17 @@ >You can also find detailed information in the following Errors.go files: * [evidence/types/errors.go](evidence/types/errors.go) +## Fbridge + +|Error Name|Codespace|Code|Description| +|:-|:-|:-|:-| +|ErrUnknownProposal|fbridge|2|unknown proposal| +|ErrUnknownVote|fbridge|3|unknown vote| +|ErrInactiveBridge|fbridge|4|the bridge has halted| + +>You can also find detailed information in the following Errors.go files: + * [fbridge/types/errors.go](fbridge/types/errors.go) + ## Feegrant |Error Name|Codespace|Code|Description| diff --git a/x/fbridge/client/cli/query.go b/x/fbridge/client/cli/query.go index 4878af22e7..19708afb6e 100644 --- a/x/fbridge/client/cli/query.go +++ b/x/fbridge/client/cli/query.go @@ -2,6 +2,7 @@ package cli import ( "fmt" + "strconv" "github.com/spf13/cobra" @@ -23,13 +24,45 @@ func NewQueryCmd() *cobra.Command { } cmd.AddCommand( + NewQueryParamsCmd(), NewQueryNextSeqSendCmd(), NewQuerySeqToBlocknumsCmd(), + NewQueryMembersCmd(), + NewQueryMemberCmd(), + NewQueryProposalsCmd(), + NewQueryProposalCmd(), + NewQueryVotesCmd(), + NewQueryVoteCmd(), + NewQueryBridgeStatusCmd(), ) return cmd } +func NewQueryParamsCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "params", + Short: "Query the current fbridge module parameters", + 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.Params(cmd.Context(), &types.QueryParamsRequest{}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + return cmd +} + func NewQueryNextSeqSendCmd() *cobra.Command { cmd := &cobra.Command{ Use: "sending-next-seq", @@ -59,7 +92,7 @@ func NewQuerySeqToBlocknumsCmd() *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), + Example: fmt.Sprintf("%s query %s 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 { @@ -90,3 +123,202 @@ func NewQuerySeqToBlocknumsCmd() *cobra.Command { flags.AddQueryFlagsToCmd(cmd) return cmd } + +func NewQueryMembersCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "members [role]", + Short: "Query the members of spcific group registered on the bridge (guardian|operator|judge)", + Args: cobra.ExactArgs(1), + Example: fmt.Sprintf("%s query %s members guardian", 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) + + res, err := qc.Members(cmd.Context(), &types.QueryMembersRequest{Role: args[0]}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + return cmd +} + +func NewQueryMemberCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "member [address]", + Short: "Query the roles of a specific member registered on the bridge", + Args: cobra.ExactArgs(1), + Example: fmt.Sprintf("%s query %s member link1...", 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) + + res, err := qc.Member(cmd.Context(), &types.QueryMemberRequest{Address: args[0]}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + return cmd +} + +func NewQueryProposalsCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "proposals", + Short: "Query all role proposals", + Args: cobra.NoArgs, + Example: fmt.Sprintf("%s query %s proposals", 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) + pageReq, err := client.ReadPageRequest(cmd.Flags()) + if err != nil { + return err + } + + res, err := qc.Proposals(cmd.Context(), &types.QueryProposalsRequest{Pagination: pageReq}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + flags.AddPaginationFlagsToCmd(cmd, "all proposals") + return cmd +} + +func NewQueryProposalCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "proposal [proposal_id]", + Short: "Query a specific role proposal", + Args: cobra.ExactArgs(1), + Example: fmt.Sprintf("%s query %s proposal 1", 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) + + id, err := strconv.ParseUint(args[0], 10, 64) + if err != nil { + return err + } + + res, err := qc.Proposal(cmd.Context(), &types.QueryProposalRequest{ProposalId: id}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + return cmd +} + +func NewQueryVotesCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "votes [proposal_id]", + Short: "Query all votes for a specific role proposal", + Args: cobra.ExactArgs(1), + Example: fmt.Sprintf("%s query %s votes 1", 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) + + id, err := strconv.ParseUint(args[0], 10, 64) + if err != nil { + return err + } + + res, err := qc.Votes(cmd.Context(), &types.QueryVotesRequest{ProposalId: id}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + return cmd +} + +func NewQueryVoteCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "vote [proposal_id] [voter]", + Short: "Query a specific vote for a role proposal", + Args: cobra.ExactArgs(2), + Example: fmt.Sprintf("%s query %s vote 1 link1...", 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) + + id, err := strconv.ParseUint(args[0], 10, 64) + if err != nil { + return err + } + + res, err := qc.Vote(cmd.Context(), &types.QueryVoteRequest{ProposalId: id, Voter: args[1]}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + return cmd +} + +func NewQueryBridgeStatusCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "status", + Short: "Query the current status of the bridge", + 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.BridgeStatus(cmd.Context(), &types.QueryBridgeStatusRequest{}) + if err != nil { + return err + } + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + return cmd +} diff --git a/x/fbridge/client/cli/tx.go b/x/fbridge/client/cli/tx.go index 8aa3b892bb..887e5bf586 100644 --- a/x/fbridge/client/cli/tx.go +++ b/x/fbridge/client/cli/tx.go @@ -1,6 +1,9 @@ package cli import ( + "fmt" + "strconv" + "github.com/spf13/cobra" "github.com/Finschia/finschia-sdk/client" @@ -8,6 +11,7 @@ import ( "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/version" "github.com/Finschia/finschia-sdk/x/fbridge/types" ) @@ -23,6 +27,9 @@ func NewTxCmd() *cobra.Command { TxCmd.AddCommand( NewTransferTxCmd(), + NewSuggestRoleTxCmd(), + NewAddVoteForRoleTxCmd(), + NewSetBridgeStatusTxCmd(), ) return TxCmd @@ -30,9 +37,10 @@ func NewTxCmd() *cobra.Command { 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), + Use: "transfer [to_address] [amount]", + Short: `Transfer token from current chain to counterparty chain`, + Example: fmt.Sprintf("%s tx %s transfer link1... 1000cony --from mykey", version.AppName, types.ModuleName), + Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientTxContext(cmd) if err != nil { @@ -65,3 +73,119 @@ func NewTransferTxCmd() *cobra.Command { return cmd } + +func NewSuggestRoleTxCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "suggest-role [target_address] [role]", + Short: `Suggest a role to a specific address (unspecified|guardian|operator|judge)`, + Args: cobra.ExactArgs(2), + Example: fmt.Sprintf("%s tx %s suggest-role link1... guardian --from guardiankey", version.AppName, types.ModuleName), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + from := clientCtx.GetFromAddress().String() + if _, err := sdk.AccAddressFromBech32(from); err != nil { + return sdkerrors.ErrInvalidAddress.Wrapf("invalid address: %s", from) + } + target := args[0] + role, found := types.QueryParamToRole[args[1]] + if !found { + return sdkerrors.ErrInvalidRequest.Wrapf("invalid role: %s", args[1]) + } + + msg := types.MsgSuggestRole{ + From: from, + Target: target, + Role: role, + } + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + return cmd +} + +func NewAddVoteForRoleTxCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "add-vote-for-role [proposal_id] [option]", + Short: `Vote for a role proposal (yes|no)`, + Args: cobra.ExactArgs(2), + Example: fmt.Sprintf("%s tx %s add-vote-for-role 1 yes --from guardiankey", version.AppName, types.ModuleName), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + from := clientCtx.GetFromAddress().String() + if _, err := sdk.AccAddressFromBech32(from); err != nil { + return sdkerrors.ErrInvalidAddress.Wrapf("invalid address: %s", from) + } + proposalID, err := strconv.ParseUint(args[0], 10, 64) + if err != nil { + return sdkerrors.ErrInvalidRequest.Wrapf("invalid proposal ID: %s", args[0]) + } + + voteOpts := map[string]types.VoteOption{ + "yes": types.OptionYes, + "no": types.OptionNo, + } + option, found := voteOpts[args[1]] + if !found { + return sdkerrors.ErrInvalidRequest.Wrapf("invalid vote option: %s", args[1]) + } + + msg := types.MsgAddVoteForRole{ + From: from, + ProposalId: proposalID, + Option: option, + } + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + return cmd +} + +func NewSetBridgeStatusTxCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "set-bridge-status [status]", + Short: `Set sender's bridge switch for halting/resuming the bridge module. Each guardian has their own switch. (halt|resume)`, + Args: cobra.ExactArgs(1), + Example: fmt.Sprintf("%s tx %s set-bridge-status halt --from guardiankey\n"+ + "%s tx %s set-bridge-status resume --from guardiankey\n", version.AppName, types.ModuleName, version.AppName, types.ModuleName), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + from := clientCtx.GetFromAddress().String() + if _, err := sdk.AccAddressFromBech32(from); err != nil { + return sdkerrors.ErrInvalidAddress.Wrapf("invalid address: %s", from) + } + + conv := map[string]types.BridgeStatus{ + "halt": types.StatusInactive, + "resume": types.StatusActive, + } + + msg := types.MsgSetBridgeStatus{ + Guardian: from, + Status: conv[args[0]], + } + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + return cmd +} diff --git a/x/fbridge/keeper/abci.go b/x/fbridge/keeper/abci.go new file mode 100644 index 0000000000..28b5333b1f --- /dev/null +++ b/x/fbridge/keeper/abci.go @@ -0,0 +1,65 @@ +package keeper + +import ( + "fmt" + + sdk "github.com/Finschia/finschia-sdk/types" + "github.com/Finschia/finschia-sdk/x/fbridge/types" +) + +func (k Keeper) BeginBlocker(ctx sdk.Context) { + k.InitMemStore(ctx) + + proposals := k.GetRoleProposals(ctx) + for _, proposal := range proposals { + if ctx.BlockTime().After(proposal.ExpiredAt) { + k.deleteRoleProposal(ctx, proposal.Id) + } + } +} + +func (k Keeper) EndBlocker(ctx sdk.Context) { + guardianTrustLevel := k.GetParams(ctx).GuardianTrustLevel + proposals := k.GetRoleProposals(ctx) + for _, proposal := range proposals { + votes := k.GetProposalVotes(ctx, proposal.Id) + + var voteYes uint64 = 0 + for _, vote := range votes { + if vote.Option == types.OptionYes { + voteYes++ + } + } + + if types.CheckTrustLevelThreshold(k.GetRoleMetadata(ctx).Guardian, voteYes, guardianTrustLevel) || proposal.Proposer == k.GetAuthority() { + if err := k.updateRole(ctx, proposal.Role, sdk.MustAccAddressFromBech32(proposal.Target)); err != nil { + panic(err) + } + + k.deleteRoleProposal(ctx, proposal.Id) + } + } +} + +// RegisterInvariants registers the fbridge module invariants +func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper) { + ir.RegisterRoute(types.ModuleName, "guardian-invariant", GuardianInvariant(k)) +} + +func GuardianInvariant(k Keeper) sdk.Invariant { + return func(ctx sdk.Context) (string, bool) { + numGuardian := 0 + for _, p := range k.GetRolePairs(ctx) { + if p.Role == types.RoleGuardian { + numGuardian++ + } + } + + numBridgeSw := len(k.GetBridgeSwitches(ctx)) + broken := numGuardian != numBridgeSw + return sdk.FormatInvariant( + types.ModuleName, "guardian-invariant", + fmt.Sprintf("number of guardians(%d) != number of bridge switches(%d)", numGuardian, numBridgeSw), + ), broken + } +} diff --git a/x/fbridge/keeper/auth.go b/x/fbridge/keeper/auth.go new file mode 100644 index 0000000000..86070efe83 --- /dev/null +++ b/x/fbridge/keeper/auth.go @@ -0,0 +1,331 @@ +package keeper + +import ( + "encoding/binary" + "fmt" + "time" + + 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) RegisterRoleProposal(ctx sdk.Context, proposer, target sdk.AccAddress, role types.Role) (types.RoleProposal, error) { + if k.GetRoleMetadata(ctx).Guardian > 0 { + if k.GetRole(ctx, proposer) != types.RoleGuardian { + return types.RoleProposal{}, sdkerrors.ErrUnauthorized.Wrapf("only guardian can execute this action") + } + } else { + if proposer.String() != k.authority { + return types.RoleProposal{}, sdkerrors.ErrUnauthorized.Wrapf("only %s can execute this action", k.authority) + } + } + + if k.GetRole(ctx, target) == role { + return types.RoleProposal{}, sdkerrors.ErrUnauthorized.Wrap("target already has same role") + } + + proposalID := k.GetNextProposalID(ctx) + proposal := types.RoleProposal{ + Id: proposalID, + Proposer: proposer.String(), + Target: target.String(), + Role: role, + ExpiredAt: ctx.BlockTime().Add(time.Duration(k.GetParams(ctx).ProposalPeriod)).UTC(), + } + + k.setRoleProposal(ctx, proposal) + k.setNextProposalID(ctx, proposalID+1) + + return proposal, nil +} + +func (k Keeper) addVote(ctx sdk.Context, proposalID uint64, voter sdk.AccAddress, option types.VoteOption) error { + if k.GetRole(ctx, voter) != types.RoleGuardian { + return sdkerrors.ErrUnauthorized.Wrap("only guardian can execute this action") + } + + _, found := k.GetRoleProposal(ctx, proposalID) + if !found { + return types.ErrUnknownProposal.Wrapf("#%d not found", proposalID) + } + + if err := types.IsValidVoteOption(option); err != nil { + return sdkerrors.ErrInvalidRequest.Wrap(err.Error()) + } + + k.setVote(ctx, proposalID, voter, option) + + return nil +} + +func (k Keeper) updateRole(ctx sdk.Context, role types.Role, addr sdk.AccAddress) error { + previousRole := k.GetRole(ctx, addr) + if previousRole == role { + return sdkerrors.ErrInvalidRequest.Wrap("target already has same role") + } + + roleMeta := k.GetRoleMetadata(ctx) + nInactive := k.GetBridgeInactiveCounter(ctx) + + switch previousRole { + case types.RoleGuardian: + roleMeta.Guardian-- + + bs, err := k.GetBridgeSwitch(ctx, addr) + if err != nil { + return err + } + + if bs.Status == types.StatusInactive { + nInactive-- + } + + k.deleteBridgeSwitch(ctx, addr) + + case types.RoleOperator: + roleMeta.Operator-- + case types.RoleJudge: + roleMeta.Judge-- + } + + if role == types.RoleEmpty { + k.deleteRole(ctx, addr) + return nil + } else { + if err := k.setRole(ctx, role, addr); err != nil { + return err + } + } + + switch role { + case types.RoleGuardian: + roleMeta.Guardian++ + if err := k.setBridgeSwitch(ctx, addr, types.StatusActive); err != nil { + panic(err) + } + case types.RoleOperator: + roleMeta.Operator++ + case types.RoleJudge: + roleMeta.Judge++ + } + + k.setRoleMetadata(ctx, roleMeta) + k.setBridgeInactiveCounter(ctx, nInactive) + + return nil +} + +func (k Keeper) updateBridgeSwitch(ctx sdk.Context, guardian sdk.AccAddress, status types.BridgeStatus) error { + if sw, err := k.GetBridgeSwitch(ctx, guardian); err == nil && sw.Status == status { + return sdkerrors.ErrInvalidRequest.Wrapf("%s already set %s", guardian, status) + } else if err != nil { + return err + } + + nInactive := k.GetBridgeInactiveCounter(ctx) + switch status { + case types.StatusActive: + nInactive-- + case types.StatusInactive: + nInactive++ + default: + return sdkerrors.ErrInvalidRequest.Wrapf("unknown bridge status: %d", status) + } + k.setBridgeInactiveCounter(ctx, nInactive) + + if err := k.setBridgeSwitch(ctx, guardian, status); err != nil { + return err + } + + return nil +} + +func (k Keeper) setNextProposalID(ctx sdk.Context, seq uint64) { + store := ctx.KVStore(k.storeKey) + bz := make([]byte, 8) + binary.BigEndian.PutUint64(bz, seq) + store.Set(types.KeyNextProposalID, bz) +} + +func (k Keeper) GetNextProposalID(ctx sdk.Context) uint64 { + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.KeyNextProposalID) + if bz == nil { + panic("next role proposal ID must be set at genesis") + } + + return binary.BigEndian.Uint64(bz) +} + +func (k Keeper) setRoleProposal(ctx sdk.Context, proposal types.RoleProposal) { + store := ctx.KVStore(k.storeKey) + bz := k.cdc.MustMarshal(&proposal) + store.Set(types.ProposalKey(proposal.Id), bz) +} + +func (k Keeper) GetRoleProposal(ctx sdk.Context, id uint64) (proposal types.RoleProposal, found bool) { + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.ProposalKey(id)) + if bz == nil { + return proposal, false + } + + k.cdc.MustUnmarshal(bz, &proposal) + return proposal, true +} + +func (k Keeper) deleteRoleProposal(ctx sdk.Context, id uint64) { + store := ctx.KVStore(k.storeKey) + if _, found := k.GetRoleProposal(ctx, id); !found { + panic(fmt.Sprintf("role proposal #%d not found", id)) + } + store.Delete(types.ProposalKey(id)) +} + +// IterateProposals iterates over the all the role proposals and performs a callback function +func (k Keeper) IterateProposals(ctx sdk.Context, cb func(proposal types.RoleProposal) (stop bool)) { + store := ctx.KVStore(k.storeKey) + + iterator := sdk.KVStorePrefixIterator(store, types.KeyProposalPrefix) + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + var proposal types.RoleProposal + k.cdc.MustUnmarshal(iterator.Value(), &proposal) + if cb(proposal) { + break + } + } +} + +// GetRoleProposals returns all the role proposals from store +func (k Keeper) GetRoleProposals(ctx sdk.Context) (proposals []types.RoleProposal) { + k.IterateProposals(ctx, func(proposal types.RoleProposal) bool { + proposals = append(proposals, proposal) + return false + }) + return +} + +func (k Keeper) setVote(ctx sdk.Context, proposalID uint64, voter sdk.AccAddress, option types.VoteOption) { + store := ctx.KVStore(k.storeKey) + bz := make([]byte, 4) + binary.BigEndian.PutUint32(bz, uint32(option)) + store.Set(types.VoterVoteKey(proposalID, voter), bz) +} + +func (k Keeper) GetVote(ctx sdk.Context, proposalID uint64, voter sdk.AccAddress) (types.VoteOption, error) { + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.VoterVoteKey(proposalID, voter)) + if bz == nil { + return types.OptionEmpty, types.ErrUnknownVote + } + + return types.VoteOption(binary.BigEndian.Uint32(bz)), nil +} + +func (k Keeper) GetProposalVotes(ctx sdk.Context, proposalID uint64) []types.Vote { + store := ctx.KVStore(k.storeKey) + + votes := make([]types.Vote, 0) + iterator := sdk.KVStorePrefixIterator(store, types.VotesKey(proposalID)) + defer iterator.Close() + for ; iterator.Valid(); iterator.Next() { + _, voter := types.SplitVoterVoteKey(iterator.Key()) + v := types.Vote{ + ProposalId: proposalID, + Voter: voter.String(), + Option: types.VoteOption(binary.BigEndian.Uint32(iterator.Value())), + } + votes = append(votes, v) + } + + return votes +} + +func (k Keeper) setRole(ctx sdk.Context, role types.Role, addr sdk.AccAddress) error { + if err := types.IsValidRole(role); err != nil { + return sdkerrors.ErrInvalidRequest.Wrap(err.Error()) + } + + store := ctx.KVStore(k.storeKey) + bz := make([]byte, 4) + binary.BigEndian.PutUint32(bz, uint32(role)) + store.Set(types.RoleKey(addr), bz) + + return nil +} + +func (k Keeper) GetRole(ctx sdk.Context, addr sdk.AccAddress) types.Role { + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.RoleKey(addr)) + if bz == nil { + return types.RoleEmpty + } + + return types.Role(binary.BigEndian.Uint32(bz)) +} + +func (k Keeper) GetRolePairs(ctx sdk.Context) []types.RolePair { + store := ctx.KVStore(k.storeKey) + pairs := make([]types.RolePair, 0) + iterator := sdk.KVStorePrefixIterator(store, types.KeyRolePrefix) + defer iterator.Close() + for ; iterator.Valid(); iterator.Next() { + assignee := types.SplitRoleKey(iterator.Key()) + pairs = append(pairs, types.RolePair{Address: assignee.String(), Role: types.Role(binary.BigEndian.Uint32(iterator.Value()))}) + } + + return pairs +} + +func (k Keeper) deleteRole(ctx sdk.Context, addr sdk.AccAddress) { + store := ctx.KVStore(k.storeKey) + store.Delete(types.RoleKey(addr)) +} + +func (k Keeper) setBridgeSwitch(ctx sdk.Context, guardian sdk.AccAddress, status types.BridgeStatus) error { + if err := types.IsValidBridgeStatus(status); err != nil { + return sdkerrors.ErrInvalidRequest.Wrap(err.Error()) + } + + store := ctx.KVStore(k.storeKey) + bz := make([]byte, 4) + binary.BigEndian.PutUint32(bz, uint32(status)) + store.Set(types.BridgeSwitchKey(guardian), bz) + return nil +} + +func (k Keeper) deleteBridgeSwitch(ctx sdk.Context, guardian sdk.AccAddress) { + store := ctx.KVStore(k.storeKey) + store.Delete(types.BridgeSwitchKey(guardian)) +} + +func (k Keeper) GetBridgeSwitch(ctx sdk.Context, guardian sdk.AccAddress) (types.BridgeSwitch, error) { + if k.GetRole(ctx, guardian) != types.RoleGuardian { + return types.BridgeSwitch{}, sdkerrors.ErrUnauthorized.Wrap("only guardian has bridge switch") + } + + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.BridgeSwitchKey(guardian)) + if bz == nil { + panic("bridge switch must be set at genesis") + } + + return types.BridgeSwitch{Guardian: guardian.String(), Status: types.BridgeStatus(binary.BigEndian.Uint32(bz))}, nil +} + +func (k Keeper) GetBridgeSwitches(ctx sdk.Context) []types.BridgeSwitch { + store := ctx.KVStore(k.storeKey) + + bws := make([]types.BridgeSwitch, 0) + iterator := sdk.KVStorePrefixIterator(store, types.KeyBridgeSwitchPrefix) + defer iterator.Close() + for ; iterator.Valid(); iterator.Next() { + addr := types.SplitBridgeSwitchKey(iterator.Key()) + bws = append(bws, types.BridgeSwitch{Guardian: addr.String(), Status: types.BridgeStatus(binary.BigEndian.Uint32(iterator.Value()))}) + } + + return bws +} diff --git a/x/fbridge/keeper/auth_test.go b/x/fbridge/keeper/auth_test.go new file mode 100644 index 0000000000..fb773014e3 --- /dev/null +++ b/x/fbridge/keeper/auth_test.go @@ -0,0 +1,89 @@ +package keeper + +import ( + "testing" + + "github.com/stretchr/testify/require" + + "github.com/Finschia/finschia-sdk/x/fbridge/testutil" + "github.com/Finschia/finschia-sdk/x/fbridge/types" +) + +func TestAssignRole(t *testing.T) { + key, memKey, ctx, encCfg, authKeeper, bankKeeper, addrs := testutil.PrepareFbridgeTest(t, 3) + auth := types.DefaultAuthority() + k := NewKeeper(encCfg.Codec, key, memKey, authKeeper, bankKeeper, "stake", auth.String()) + err := k.InitGenesis(ctx, types.DefaultGenesisState()) + require.NoError(t, err) + + // 1. Bridge authority assigns an address to a guardian role + p, err := k.RegisterRoleProposal(ctx, addrs[0], addrs[1], types.RoleGuardian) + require.Error(t, err, "role proposal must not be passed without authority") + require.Equal(t, types.RoleProposal{}, p) + p, err = k.RegisterRoleProposal(ctx, auth, addrs[0], types.RoleGuardian) + require.NoError(t, err) + require.EqualValues(t, 1, p.Id) + err = k.updateRole(ctx, types.RoleGuardian, addrs[0]) + require.NoError(t, err) + require.Equal(t, types.RoleGuardian, k.GetRole(ctx, addrs[0])) + require.Equal(t, types.RoleMetadata{Guardian: 1, Operator: 0, Judge: 0}, k.GetRoleMetadata(ctx)) + + // 2. Guardian assigns an address to a guardian role + _, err = k.RegisterRoleProposal(ctx, auth, addrs[1], types.RoleGuardian) + require.Error(t, err, "role proposal must be passed with guardian role after guardian group is formed") + p, err = k.RegisterRoleProposal(ctx, addrs[0], addrs[1], types.RoleGuardian) + require.NoError(t, err, "role proposal must be passed with guardian role") + require.EqualValues(t, 2, p.Id) + err = k.addVote(ctx, p.Id, addrs[0], types.OptionYes) + require.NoError(t, err) + opt, err := k.GetVote(ctx, p.Id, addrs[0]) + require.NoError(t, err) + require.Equal(t, types.OptionYes, opt) + err = k.updateRole(ctx, types.RoleGuardian, addrs[1]) + require.NoError(t, err) + require.Equal(t, types.RoleMetadata{Guardian: 2, Operator: 0, Judge: 0}, k.GetRoleMetadata(ctx)) + sws := k.GetBridgeSwitches(ctx) + require.Len(t, sws, 2) + for _, sw := range sws { + require.Equal(t, types.StatusActive, sw.Status) + } + + // 3. Guardian assigns an address to an operator role + err = k.updateRole(ctx, types.RoleOperator, addrs[1]) + require.NoError(t, err) + require.Equal(t, types.RoleMetadata{Guardian: 1, Operator: 1, Judge: 0}, k.GetRoleMetadata(ctx)) + + // 4. Guardian assigns an address to a same role + err = k.updateRole(ctx, types.RoleOperator, addrs[1]) + require.Error(t, err, "role must not be updated to the same role") +} + +func TestBridgeHaltAndResume(t *testing.T) { + key, memKey, ctx, encCfg, authKeeper, bankKeeper, addrs := testutil.PrepareFbridgeTest(t, 3) + auth := types.DefaultAuthority() + k := NewKeeper(encCfg.Codec, key, memKey, authKeeper, bankKeeper, "stake", auth.String()) + err := k.InitGenesis(ctx, types.DefaultGenesisState()) + require.NoError(t, err) + for _, addr := range addrs { + err = k.updateRole(ctx, types.RoleGuardian, addr) + require.NoError(t, err) + } + + require.Equal(t, types.StatusActive, k.GetBridgeStatus(ctx), "bridge status must be active (3/3)") + require.Equal(t, types.BridgeStatusMetadata{Active: 3, Inactive: 0}, k.GetBridgeStatusMetadata(ctx)) + + err = k.updateBridgeSwitch(ctx, addrs[0], types.StatusInactive) + require.NoError(t, err) + require.Equal(t, types.StatusActive, k.GetBridgeStatus(ctx), "bridge status must be active (2/3)") + require.Equal(t, types.BridgeStatusMetadata{Active: 2, Inactive: 1}, k.GetBridgeStatusMetadata(ctx)) + + err = k.updateBridgeSwitch(ctx, addrs[1], types.StatusInactive) + require.NoError(t, err) + require.Equal(t, types.StatusInactive, k.GetBridgeStatus(ctx), "bridge status must be inactive (1/3)") + require.Equal(t, types.BridgeStatusMetadata{Active: 1, Inactive: 2}, k.GetBridgeStatusMetadata(ctx)) + + err = k.updateBridgeSwitch(ctx, addrs[0], types.StatusActive) + require.NoError(t, err) + require.Equal(t, types.StatusActive, k.GetBridgeStatus(ctx), "bridge status must be active (2/3)") + require.Equal(t, types.BridgeStatusMetadata{Active: 2, Inactive: 1}, k.GetBridgeStatusMetadata(ctx)) +} diff --git a/x/fbridge/keeper/genesis.go b/x/fbridge/keeper/genesis.go index 9312e18a97..486f35ea68 100644 --- a/x/fbridge/keeper/genesis.go +++ b/x/fbridge/keeper/genesis.go @@ -8,20 +8,53 @@ import ( ) func (k Keeper) InitGenesis(ctx sdk.Context, gs *types.GenesisState) error { + k.SetParams(ctx, gs.Params) k.setNextSequence(ctx, gs.SendingState.NextSeq) for _, info := range gs.SendingState.SeqToBlocknum { k.setSeqToBlocknum(ctx, info.Seq, info.Blocknum) } + for _, pair := range gs.Roles { + if err := k.setRole(ctx, pair.Role, sdk.MustAccAddressFromBech32(pair.Address)); err != nil { + panic(err) + } + } + + for _, sw := range gs.BridgeSwitches { + if err := k.setBridgeSwitch(ctx, sdk.MustAccAddressFromBech32(sw.Guardian), sw.Status); err != nil { + panic(err) + } + } + + k.setNextProposalID(ctx, gs.NextRoleProposalId) + for _, proposal := range gs.RoleProposals { + k.setRoleProposal(ctx, proposal) + } + + for _, vote := range gs.Votes { + k.setVote(ctx, vote.ProposalId, sdk.MustAccAddressFromBech32(vote.Voter), vote.Option) + } + + // TODO: we initialize the appropriate genesis parameters whenever the feature is added + + k.InitMemStore(ctx) + return nil } func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { return &types.GenesisState{ + Params: k.GetParams(ctx), SendingState: types.SendingState{ NextSeq: k.GetNextSequence(ctx), SeqToBlocknum: k.getAllSeqToBlocknums(ctx), }, + ReceivingState: types.ReceivingState{}, + NextRoleProposalId: k.GetNextProposalID(ctx), + RoleProposals: k.GetRoleProposals(ctx), + Votes: k.GetAllVotes(ctx), + Roles: k.GetRolePairs(ctx), + BridgeSwitches: k.GetBridgeSwitches(ctx), } } @@ -40,3 +73,28 @@ func (k Keeper) getAllSeqToBlocknums(ctx sdk.Context) []types.BlockSeqInfo { return infos } + +// IterateVotes iterates over the all the votes for role proposals and performs a callback function +func (k Keeper) IterateVotes(ctx sdk.Context, cb func(proposal types.Vote) (stop bool)) { + store := ctx.KVStore(k.storeKey) + + iterator := sdk.KVStorePrefixIterator(store, types.KeyProposalVotePrefix) + defer iterator.Close() + for ; iterator.Valid(); iterator.Next() { + id, voter := types.SplitVoterVoteKey(iterator.Key()) + opt := types.VoteOption(binary.BigEndian.Uint32(iterator.Value())) + v := types.Vote{ProposalId: id, Voter: voter.String(), Option: opt} + if cb(v) { + break + } + } +} + +// GetAllVotes returns all the votes from the store +func (k Keeper) GetAllVotes(ctx sdk.Context) (votes []types.Vote) { + k.IterateVotes(ctx, func(vote types.Vote) bool { + votes = append(votes, vote) + return false + }) + return +} diff --git a/x/fbridge/keeper/grpc_query.go b/x/fbridge/keeper/grpc_query.go index e2460064c2..7c7046a535 100644 --- a/x/fbridge/keeper/grpc_query.go +++ b/x/fbridge/keeper/grpc_query.go @@ -7,14 +7,24 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/status" + "github.com/Finschia/finschia-sdk/store/prefix" sdk "github.com/Finschia/finschia-sdk/types" + sdkerrors "github.com/Finschia/finschia-sdk/types/errors" + "github.com/Finschia/finschia-sdk/types/query" "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) Params(goCtx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + + ctx := sdk.UnwrapSDKContext(goCtx) + params := k.GetParams(ctx) + + return &types.QueryParamsResponse{Params: params}, nil } func (k Keeper) NextSeqSend(goCtx context.Context, req *types.QueryNextSeqSendRequest) (*types.QueryNextSeqSendResponse, error) { @@ -53,45 +63,136 @@ func (k Keeper) SeqToBlocknums(goCtx context.Context, req *types.QuerySeqToBlock } func (k Keeper) GreatestSeqByOperator(ctx context.Context, request *types.QueryGreatestSeqByOperatorRequest) (*types.QueryGreatestSeqByOperatorResponse, error) { - panic("implement me") + panic(sdkerrors.ErrNotSupported) } func (k Keeper) GreatestConsecutiveConfirmedSeq(ctx context.Context, request *types.QueryGreatestConsecutiveConfirmedSeqRequest) (*types.QueryGreatestConsecutiveConfirmedSeqResponse, error) { - panic("implement me") + panic(sdkerrors.ErrNotSupported) } func (k Keeper) SubmittedProvision(ctx context.Context, request *types.QuerySubmittedProvisionRequest) (*types.QuerySubmittedProvisionResponse, error) { - panic("implement me") + panic(sdkerrors.ErrNotSupported) } func (k Keeper) ConfirmedProvision(ctx context.Context, request *types.QueryConfirmedProvisionRequest) (*types.QueryConfirmedProvisionResponse, error) { - panic("implement me") + panic(sdkerrors.ErrNotSupported) } func (k Keeper) NeededSubmissionSeqs(ctx context.Context, request *types.QueryNeededSubmissionSeqsRequest) (*types.QueryNeededSubmissionSeqsResponse, error) { - panic("implement me") + panic(sdkerrors.ErrNotSupported) } func (k Keeper) Commitments(ctx context.Context, request *types.QueryCommitmentsRequest) (*types.QueryCommitmentsResponse, error) { - panic("implement me") + panic(sdkerrors.ErrNotSupported) +} + +func (k Keeper) Members(goCtx context.Context, req *types.QueryMembersRequest) (*types.QueryMembersResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + + ctx := sdk.UnwrapSDKContext(goCtx) + roles := k.GetRolePairs(ctx) + members := make([]string, 0) + + if req.Role == "" { + for _, pair := range roles { + members = append(members, pair.Address) + } + } else { + role, found := types.QueryParamToRole[req.Role] + if !found { + return nil, status.Error(codes.InvalidArgument, "invalid role") + } + + for _, pair := range roles { + if pair.Role == role { + members = append(members, pair.Address) + } + } + } + + return &types.QueryMembersResponse{Members: members}, nil } -func (k Keeper) Guardians(ctx context.Context, request *types.QueryGuardiansRequest) (*types.QueryGuardiansResponse, error) { - panic("implement me") +func (k Keeper) Member(goCtx context.Context, req *types.QueryMemberRequest) (*types.QueryMemberResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + + ctx := sdk.UnwrapSDKContext(goCtx) + r := k.GetRole(ctx, sdk.MustAccAddressFromBech32(req.Address)) + if r == types.RoleEmpty { + return nil, status.Error(codes.NotFound, "role not found") + } + + return &types.QueryMemberResponse{Role: types.Role_name[int32(r)]}, nil +} + +func (k Keeper) Proposals(goCtx context.Context, req *types.QueryProposalsRequest) (*types.QueryProposalsResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + + ctx := sdk.UnwrapSDKContext(goCtx) + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyProposalPrefix) + proposals := make([]types.RoleProposal, 0) + pageRes, err := query.Paginate(store, req.Pagination, func(_, value []byte) error { + var proposal types.RoleProposal + k.cdc.MustUnmarshal(value, &proposal) + proposals = append(proposals, proposal) + return nil + }) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &types.QueryProposalsResponse{Proposals: proposals, Pagination: pageRes}, nil } -func (k Keeper) Operators(ctx context.Context, request *types.QueryOperatorsRequest) (*types.QueryOperatorsResponse, error) { - panic("implement me") +func (k Keeper) Proposal(goCtx context.Context, req *types.QueryProposalRequest) (*types.QueryProposalResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + + ctx := sdk.UnwrapSDKContext(goCtx) + proposal, found := k.GetRoleProposal(ctx, req.ProposalId) + if !found { + return nil, status.Error(codes.NotFound, fmt.Sprintf("role proposal %d", req.ProposalId)) + } + + return &types.QueryProposalResponse{Proposal: proposal}, nil } -func (k Keeper) Judges(ctx context.Context, request *types.QueryJudgesRequest) (*types.QueryJudgesResponse, error) { - panic("implement me") +func (k Keeper) Votes(goCtx context.Context, req *types.QueryVotesRequest) (*types.QueryVotesResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + + ctx := sdk.UnwrapSDKContext(goCtx) + votes := k.GetProposalVotes(ctx, req.ProposalId) + return &types.QueryVotesResponse{Votes: votes}, nil } -func (k Keeper) Proposals(ctx context.Context, request *types.QueryProposalsRequest) (*types.QueryProposalsResponse, error) { - panic("implement me") +func (k Keeper) Vote(goCtx context.Context, req *types.QueryVoteRequest) (*types.QueryVoteResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + + ctx := sdk.UnwrapSDKContext(goCtx) + opt, err := k.GetVote(ctx, req.ProposalId, sdk.MustAccAddressFromBech32(req.Voter)) + if err != nil { + return nil, status.Error(codes.NotFound, err.Error()) + } + + return &types.QueryVoteResponse{Vote: types.Vote{ProposalId: req.ProposalId, Voter: req.Voter, Option: opt}}, nil } -func (k Keeper) Proposal(ctx context.Context, request *types.QueryProposalRequest) (*types.QueryProposalResponse, error) { - panic("implement me") +func (k Keeper) BridgeStatus(goCtx context.Context, req *types.QueryBridgeStatusRequest) (*types.QueryBridgeStatusResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + + ctx := sdk.UnwrapSDKContext(goCtx) + return &types.QueryBridgeStatusResponse{Status: k.GetBridgeStatus(ctx), Metadata: k.GetBridgeStatusMetadata(ctx)}, nil } diff --git a/x/fbridge/keeper/keeper.go b/x/fbridge/keeper/keeper.go index 6059da88bc..18cc8e0ef9 100644 --- a/x/fbridge/keeper/keeper.go +++ b/x/fbridge/keeper/keeper.go @@ -1,7 +1,9 @@ package keeper import ( + "encoding/binary" "errors" + "fmt" "github.com/tendermint/tendermint/libs/log" @@ -12,6 +14,7 @@ import ( type Keeper struct { storeKey sdk.StoreKey + memKey sdk.StoreKey cdc codec.BinaryCodec authKeeper types.AccountKeeper bankKeeper types.BankKeeper @@ -19,30 +22,31 @@ type Keeper struct { // 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 can give a role to a specific address like guardian authority string } func NewKeeper( cdc codec.BinaryCodec, - key sdk.StoreKey, + key, memKey sdk.StoreKey, authKeeper types.AccountKeeper, bankKeeper types.BankKeeper, - targetDenom string, - authority string, + targetDenom, 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")) + for _, addr := range types.AuthorityCandiates() { + if authority == addr.String() { + break + } + panic("x/bridge authority must be the gov or foundation module account") } return Keeper{ storeKey: key, + memKey: memKey, cdc: cdc, authKeeper: authKeeper, bankKeeper: bankKeeper, @@ -55,6 +59,108 @@ func (k Keeper) Logger(ctx sdk.Context) log.Logger { return ctx.Logger().With("module", "x/"+types.ModuleName) } +func (k Keeper) InitMemStore(ctx sdk.Context) { + memStore := ctx.KVStore(k.memKey) + memStoreType := memStore.GetStoreType() + if memStoreType != sdk.StoreTypeMemory { + panic(fmt.Sprintf("invalid memory store type; got %s, expected: %s", memStoreType, sdk.StoreTypeMemory)) + } + + // create context with no block gas meter to ensure we do not consume gas during local initialization logic. + noGasCtx := ctx.WithBlockGasMeter(sdk.NewInfiniteGasMeter()) + + roleMetadata := types.RoleMetadata{} + if !k.IsInitialized(noGasCtx) { + for _, pair := range k.GetRolePairs(noGasCtx) { + switch pair.Role { + case types.RoleGuardian: + roleMetadata.Guardian++ + case types.RoleOperator: + roleMetadata.Operator++ + case types.RoleJudge: + roleMetadata.Judge++ + } + } + k.setRoleMetadata(noGasCtx, roleMetadata) + + nInactive := uint64(0) + for _, bs := range k.GetBridgeSwitches(ctx) { + if bs.Status == types.StatusInactive { + nInactive++ + } + } + k.setBridgeInactiveCounter(noGasCtx, nInactive) + + memStore := noGasCtx.KVStore(k.memKey) + memStore.Set(types.KeyMemInitialized, []byte{1}) + } +} + +// IsInitialized returns true if the keeper is properly initialized, and false otherwise. +func (k Keeper) IsInitialized(ctx sdk.Context) bool { + memStore := ctx.KVStore(k.memKey) + return memStore.Get(types.KeyMemInitialized) != nil +} + func (k Keeper) GetAuthority() string { return k.authority } + +func (k Keeper) IsBridgeHalted(ctx sdk.Context) bool { + return k.GetBridgeStatus(ctx) == types.StatusInactive +} + +func (k Keeper) setRoleMetadata(ctx sdk.Context, data types.RoleMetadata) { + memStore := ctx.KVStore(k.memKey) + bz := k.cdc.MustMarshal(&data) + memStore.Set(types.KeyMemRoleMetadata, bz) +} + +func (k Keeper) GetRoleMetadata(ctx sdk.Context) types.RoleMetadata { + memStore := ctx.KVStore(k.memKey) + data := types.RoleMetadata{} + bz := memStore.Get(types.KeyMemRoleMetadata) + if bz == nil { + return types.RoleMetadata{} + } + k.cdc.MustUnmarshal(bz, &data) + return data +} + +func (k Keeper) GetBridgeStatus(ctx sdk.Context) types.BridgeStatus { + roleMeta := k.GetRoleMetadata(ctx) + if roleMeta.Guardian != 0 { + bsMeta := k.GetBridgeStatusMetadata(ctx) + if types.CheckTrustLevelThreshold(roleMeta.Guardian, bsMeta.Inactive, k.GetParams(ctx).GuardianTrustLevel) { + return types.StatusInactive + } + + return types.StatusActive + } + + return types.StatusInactive +} + +func (k Keeper) setBridgeInactiveCounter(ctx sdk.Context, nInactive uint64) { + memStore := ctx.KVStore(k.memKey) + bz := make([]byte, 8) + binary.BigEndian.PutUint64(bz, nInactive) + memStore.Set(types.KeyMemBridgeInactiveCounter, bz) +} + +func (k Keeper) GetBridgeInactiveCounter(ctx sdk.Context) uint64 { + memStore := ctx.KVStore(k.memKey) + bz := memStore.Get(types.KeyMemBridgeInactiveCounter) + if bz == nil { + panic("bridge inactive counter must be set at initialization") + } + + return binary.BigEndian.Uint64(bz) +} + +func (k Keeper) GetBridgeStatusMetadata(ctx sdk.Context) types.BridgeStatusMetadata { + bsMeta := types.BridgeStatusMetadata{} + bsMeta.Inactive = k.GetBridgeInactiveCounter(ctx) + bsMeta.Active = k.GetRoleMetadata(ctx).Guardian - bsMeta.Inactive + return bsMeta +} diff --git a/x/fbridge/keeper/msg_server.go b/x/fbridge/keeper/msg_server.go index 491f57c632..5f6775f4bc 100644 --- a/x/fbridge/keeper/msg_server.go +++ b/x/fbridge/keeper/msg_server.go @@ -21,6 +21,10 @@ func NewMsgServer(k Keeper) types.MsgServer { func (m msgServer) Transfer(goCtx context.Context, msg *types.MsgTransfer) (*types.MsgTransferResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) + if m.IsBridgeHalted(ctx) { + return nil, types.ErrInactiveBridge + } + from, err := sdk.AccAddressFromBech32(msg.Sender) if err != nil { return nil, sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid sender address (%s)", err) @@ -48,41 +52,94 @@ func (m msgServer) Transfer(goCtx context.Context, msg *types.MsgTransfer) (*typ } func (m msgServer) Provision(ctx context.Context, msg *types.MsgProvision) (*types.MsgProvisionResponse, error) { - panic("implement me") + panic(sdkerrors.ErrNotSupported) } func (m msgServer) HoldTransfer(ctx context.Context, msg *types.MsgHoldTransfer) (*types.MsgHoldTransferResponse, error) { - panic("implement me") + panic(sdkerrors.ErrNotSupported) } func (m msgServer) ReleaseTransfer(ctx context.Context, msg *types.MsgReleaseTransfer) (*types.MsgReleaseTransferResponse, error) { - panic("implement me") + panic(sdkerrors.ErrNotSupported) } func (m msgServer) RemoveProvision(ctx context.Context, msg *types.MsgRemoveProvision) (*types.MsgRemoveProvisionResponse, error) { - panic("implement me") + panic(sdkerrors.ErrNotSupported) } func (m msgServer) ClaimBatch(ctx context.Context, msg *types.MsgClaimBatch) (*types.MsgClaimBatchResponse, error) { - panic("implement me") + panic(sdkerrors.ErrNotSupported) } func (m msgServer) Claim(ctx context.Context, msg *types.MsgClaim) (*types.MsgClaimResponse, error) { - panic("implement me") + panic(sdkerrors.ErrNotSupported) } -func (m msgServer) SuggestRole(ctx context.Context, msg *types.MsgSuggestRole) (*types.MsgSuggestRoleResponse, error) { - panic("implement me") -} +func (m msgServer) SuggestRole(goCtx context.Context, msg *types.MsgSuggestRole) (*types.MsgSuggestRoleResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + proposer, err := sdk.AccAddressFromBech32(msg.From) + if err != nil { + return nil, sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid proposer address (%s)", err) + } + + target, err := sdk.AccAddressFromBech32(msg.Target) + if err != nil { + return nil, sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid target address (%s)", err) + } + + if err := types.IsValidRole(msg.Role); err != nil { + return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, err.Error()) + } + + proposal, err := m.RegisterRoleProposal(ctx, proposer, target, msg.Role) + if err != nil { + return nil, err + } + + if err := ctx.EventManager().EmitTypedEvent(&types.EventSuggestRole{ + Proposal: proposal, + }); err != nil { + panic(err) + } -func (m msgServer) AddVoteForRole(ctx context.Context, msg *types.MsgAddVoteForRole) (*types.MsgAddVoteForRoleResponse, error) { - panic("implement me") + return &types.MsgSuggestRoleResponse{}, nil } -func (m msgServer) Halt(ctx context.Context, msg *types.MsgHalt) (*types.MsgHaltResponse, error) { - panic("implement me") +func (m msgServer) AddVoteForRole(goCtx context.Context, msg *types.MsgAddVoteForRole) (*types.MsgAddVoteForRoleResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + voter, err := sdk.AccAddressFromBech32(msg.From) + if err != nil { + return nil, sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid proposer address (%s)", err) + } + + if err := m.addVote(ctx, msg.ProposalId, voter, msg.Option); err != nil { + return nil, err + } + + if err := ctx.EventManager().EmitTypedEvent(&types.EventAddVoteForRole{ + Voter: msg.From, + ProposalId: msg.ProposalId, + Option: msg.Option, + }); err != nil { + panic(err) + } + + return &types.MsgAddVoteForRoleResponse{}, nil } -func (m msgServer) Resume(ctx context.Context, resume *types.MsgResume) (*types.MsgResumeResponse, error) { - panic("implement me") +func (m msgServer) SetBridgeStatus(goCtx context.Context, msg *types.MsgSetBridgeStatus) (*types.MsgSetBridgeStatusResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + addr, err := sdk.AccAddressFromBech32(msg.Guardian) + if err != nil { + return nil, sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid guardian address (%s)", err) + } + + if err := m.updateBridgeSwitch(ctx, addr, msg.Status); err != nil { + return nil, err + } + + return &types.MsgSetBridgeStatusResponse{}, nil } diff --git a/x/fbridge/keeper/params.go b/x/fbridge/keeper/params.go new file mode 100644 index 0000000000..dcbfc093d7 --- /dev/null +++ b/x/fbridge/keeper/params.go @@ -0,0 +1,24 @@ +package keeper + +import ( + sdk "github.com/Finschia/finschia-sdk/types" + "github.com/Finschia/finschia-sdk/x/fbridge/types" +) + +func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { + store := ctx.KVStore(k.storeKey) + bz := k.cdc.MustMarshal(¶ms) + store.Set(types.KeyParams, bz) +} + +func (k Keeper) GetParams(ctx sdk.Context) types.Params { + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.KeyParams) + if bz == nil { + return types.DefaultParams() + } + + var params types.Params + k.cdc.MustUnmarshal(bz, ¶ms) + return params +} diff --git a/x/fbridge/keeper/transfer_test.go b/x/fbridge/keeper/transfer_test.go index ac0743ad98..4466e3d06c 100644 --- a/x/fbridge/keeper/transfer_test.go +++ b/x/fbridge/keeper/transfer_test.go @@ -7,26 +7,23 @@ import ( "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) + key, memKey, ctx, encCfg, authKeeper, bankKeeper, _ := testutil.PrepareFbridgeTest(t, 0) 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()) + k := NewKeeper(encCfg.Codec, key, memKey, authKeeper, bankKeeper, denom, types.DefaultAuthority().String()) targetSeq := uint64(2) bz := make([]byte, 8) binary.BigEndian.PutUint64(bz, targetSeq) diff --git a/x/fbridge/module/module.go b/x/fbridge/module/module.go index e7f7cfc28c..72d43c88f3 100644 --- a/x/fbridge/module/module.go +++ b/x/fbridge/module/module.go @@ -24,9 +24,11 @@ const ( ) var ( - _ module.AppModuleBasic = AppModuleBasic{} - _ module.AppModuleGenesis = AppModule{} - _ module.AppModule = AppModule{} + _ module.AppModuleBasic = AppModuleBasic{} + _ module.AppModuleGenesis = AppModule{} + _ module.AppModule = AppModule{} + _ module.BeginBlockAppModule = AppModule{} + _ module.EndBlockAppModule = AppModule{} ) // AppModuleBasic defines the basic application module used by the fbridge module. @@ -87,7 +89,7 @@ type AppModule struct { } // NewAppModule creates a new AppModule object -func NewAppModule(cdc codec.Codec, keeper keeper.Keeper) AppModule { +func NewAppModule(_ codec.Codec, keeper keeper.Keeper) AppModule { return AppModule{ keeper: keeper, } @@ -121,9 +123,21 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw // ConsensusVersion implements AppModule/ConsensusVersion. func (AppModule) ConsensusVersion() uint64 { return consensusVersion } +// BeginBlock returns the begin blocker for the fbridge module. +func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { + am.keeper.BeginBlocker(ctx) +} + +// EndBlock returns the end blocker for the fbridge module. +// It returns no validator updates. +func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { + am.keeper.EndBlocker(ctx) + return []abci.ValidatorUpdate{} +} + // RegisterInvariants does nothing, there are no invariants to enforce func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry) { - _ = ir + keeper.RegisterInvariants(ir, am.keeper) } // Deprecated: Route does nothing. diff --git a/x/fbridge/testutil/setup.go b/x/fbridge/testutil/setup.go index 029772fac0..a7258e9cf8 100644 --- a/x/fbridge/testutil/setup.go +++ b/x/fbridge/testutil/setup.go @@ -12,19 +12,22 @@ import ( "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/crypto/keys/secp256k1" "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" + authtypes "github.com/Finschia/finschia-sdk/x/auth/types" "github.com/Finschia/finschia-sdk/x/fbridge/types" ) -func DefaultContextWithDB(tb testing.TB, key, tkey storetypes.StoreKey) sdk.Context { +func DefaultContextWithDB(tb testing.TB, key, mkey, tkey storetypes.StoreKey) sdk.Context { tb.Helper() db := dbm.NewMemDB() cms := store.NewCommitMultiStore(db) cms.MountStoreWithDB(key, storetypes.StoreTypeIAVL, db) + cms.MountStoreWithDB(mkey, storetypes.StoreTypeMemory, db) cms.MountStoreWithDB(tkey, storetypes.StoreTypeTransient, db) err := cms.LoadLatestVersion() assert.NoError(tb, err) @@ -60,16 +63,23 @@ func MakeTestEncodingConfig() TestEncodingConfig { return encCfg } -func PrepareFbridgeTest(tb testing.TB) (*sdk.KVStoreKey, sdk.Context, TestEncodingConfig, *MockAccountKeeper, *MockBankKeeper) { +func PrepareFbridgeTest(tb testing.TB, n int) (*sdk.KVStoreKey, *sdk.MemoryStoreKey, sdk.Context, TestEncodingConfig, *MockAccountKeeper, *MockBankKeeper, []sdk.AccAddress) { tb.Helper() ctrl := gomock.NewController(tb) key := storetypes.NewKVStoreKey(types.StoreKey) - ctx := DefaultContextWithDB(tb, key, sdk.NewTransientStoreKey("transient_test")) + memKey := storetypes.NewMemoryStoreKey(types.MemStoreKey) + ctx := DefaultContextWithDB(tb, key, memKey, sdk.NewTransientStoreKey("transient_test")) encCfg := MakeTestEncodingConfig() authKeeper := NewMockAccountKeeper(ctrl) + authKeeper.EXPECT().GetModuleAddress(types.ModuleName).Return(authtypes.NewEmptyModuleAccount("fbridge").GetAddress()).AnyTimes() bankKeeper := NewMockBankKeeper(ctrl) - return key, ctx, encCfg, authKeeper, bankKeeper + addrs := make([]sdk.AccAddress, n) + for i := 0; i < n; i++ { + addrs[i] = sdk.AccAddress(secp256k1.GenPrivKey().PubKey().Address()) + } + + return key, memKey, ctx, encCfg, authKeeper, bankKeeper, addrs } diff --git a/x/fbridge/types/codec.go b/x/fbridge/types/codec.go index c2edd215be..745a212112 100644 --- a/x/fbridge/types/codec.go +++ b/x/fbridge/types/codec.go @@ -22,8 +22,7 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { 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") + legacy.RegisterAminoMsg(cdc, &MsgSetBridgeStatus{}, "lbm-sdk/MsgSetBridgeStatus") } func RegisterInterfaces(registrar types.InterfaceRegistry) { @@ -38,8 +37,7 @@ func RegisterInterfaces(registrar types.InterfaceRegistry) { &MsgClaim{}, &MsgSuggestRole{}, &MsgAddVoteForRole{}, - &MsgHalt{}, - &MsgResume{}, + &MsgSetBridgeStatus{}, ) msgservice.RegisterMsgServiceDesc(registrar, &_Msg_serviceDesc) diff --git a/x/fbridge/types/errors.go b/x/fbridge/types/errors.go new file mode 100644 index 0000000000..9a8b1e2db0 --- /dev/null +++ b/x/fbridge/types/errors.go @@ -0,0 +1,9 @@ +package types + +import sdkerrors "github.com/Finschia/finschia-sdk/types/errors" + +var ( + ErrUnknownProposal = sdkerrors.Register(ModuleName, 2, "unknown proposal") + ErrUnknownVote = sdkerrors.Register(ModuleName, 3, "unknown vote") + ErrInactiveBridge = sdkerrors.Register(ModuleName, 4, "the bridge has halted") +) diff --git a/x/fbridge/types/event.pb.go b/x/fbridge/types/event.pb.go index 0749710deb..e82390f62a 100644 --- a/x/fbridge/types/event.pb.go +++ b/x/fbridge/types/event.pb.go @@ -5,6 +5,7 @@ package types import ( fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" io "io" math "math" @@ -94,6 +95,113 @@ func (m *EventTransfer) GetAmount() string { return "" } +type EventSuggestRole struct { + Proposal RoleProposal `protobuf:"bytes,1,opt,name=proposal,proto3" json:"proposal"` +} + +func (m *EventSuggestRole) Reset() { *m = EventSuggestRole{} } +func (m *EventSuggestRole) String() string { return proto.CompactTextString(m) } +func (*EventSuggestRole) ProtoMessage() {} +func (*EventSuggestRole) Descriptor() ([]byte, []int) { + return fileDescriptor_a36aa6e56f2275b8, []int{1} +} +func (m *EventSuggestRole) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventSuggestRole) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventSuggestRole.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 *EventSuggestRole) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventSuggestRole.Merge(m, src) +} +func (m *EventSuggestRole) XXX_Size() int { + return m.Size() +} +func (m *EventSuggestRole) XXX_DiscardUnknown() { + xxx_messageInfo_EventSuggestRole.DiscardUnknown(m) +} + +var xxx_messageInfo_EventSuggestRole proto.InternalMessageInfo + +func (m *EventSuggestRole) GetProposal() RoleProposal { + if m != nil { + return m.Proposal + } + return RoleProposal{} +} + +type EventAddVoteForRole struct { + // the voter address + Voter string `protobuf:"bytes,1,opt,name=voter,proto3" json:"voter,omitempty"` + // the role proposal id + ProposalId uint64 `protobuf:"varint,2,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` + // the vote option + Option VoteOption `protobuf:"varint,3,opt,name=option,proto3,enum=lbm.fbridge.v1.VoteOption" json:"option,omitempty"` +} + +func (m *EventAddVoteForRole) Reset() { *m = EventAddVoteForRole{} } +func (m *EventAddVoteForRole) String() string { return proto.CompactTextString(m) } +func (*EventAddVoteForRole) ProtoMessage() {} +func (*EventAddVoteForRole) Descriptor() ([]byte, []int) { + return fileDescriptor_a36aa6e56f2275b8, []int{2} +} +func (m *EventAddVoteForRole) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventAddVoteForRole) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventAddVoteForRole.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 *EventAddVoteForRole) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventAddVoteForRole.Merge(m, src) +} +func (m *EventAddVoteForRole) XXX_Size() int { + return m.Size() +} +func (m *EventAddVoteForRole) XXX_DiscardUnknown() { + xxx_messageInfo_EventAddVoteForRole.DiscardUnknown(m) +} + +var xxx_messageInfo_EventAddVoteForRole proto.InternalMessageInfo + +func (m *EventAddVoteForRole) GetVoter() string { + if m != nil { + return m.Voter + } + return "" +} + +func (m *EventAddVoteForRole) GetProposalId() uint64 { + if m != nil { + return m.ProposalId + } + return 0 +} + +func (m *EventAddVoteForRole) GetOption() VoteOption { + if m != nil { + return m.Option + } + return OptionEmpty +} + type EventProvision struct { // the sequence number of the bridge request Seq uint64 `protobuf:"varint,1,opt,name=seq,proto3" json:"seq,omitempty"` @@ -111,7 +219,7 @@ 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} + return fileDescriptor_a36aa6e56f2275b8, []int{3} } func (m *EventProvision) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -184,7 +292,7 @@ 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} + return fileDescriptor_a36aa6e56f2275b8, []int{4} } func (m *EventConfirmProvision) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -235,7 +343,7 @@ 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} + return fileDescriptor_a36aa6e56f2275b8, []int{5} } func (m *EventClaim) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -294,6 +402,8 @@ func (m *EventClaim) GetAmount() string { func init() { proto.RegisterType((*EventTransfer)(nil), "lbm.fbridge.v1.EventTransfer") + proto.RegisterType((*EventSuggestRole)(nil), "lbm.fbridge.v1.EventSuggestRole") + proto.RegisterType((*EventAddVoteForRole)(nil), "lbm.fbridge.v1.EventAddVoteForRole") proto.RegisterType((*EventProvision)(nil), "lbm.fbridge.v1.EventProvision") proto.RegisterType((*EventConfirmProvision)(nil), "lbm.fbridge.v1.EventConfirmProvision") proto.RegisterType((*EventClaim)(nil), "lbm.fbridge.v1.EventClaim") @@ -302,25 +412,33 @@ func init() { 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, + // 408 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x52, 0x3d, 0x6f, 0xd4, 0x40, + 0x10, 0xf5, 0x12, 0xe7, 0x94, 0x4c, 0xc4, 0x29, 0x32, 0x01, 0x59, 0x56, 0xe4, 0x44, 0xae, 0x42, + 0x81, 0x4d, 0x8e, 0x1e, 0x89, 0x20, 0x22, 0x41, 0x43, 0xb4, 0x20, 0x0a, 0x1a, 0x64, 0x9f, 0xc7, + 0xce, 0x82, 0xbd, 0x63, 0x76, 0xf7, 0x2c, 0xe8, 0xa8, 0xa9, 0xf8, 0x59, 0x29, 0x53, 0x52, 0x21, + 0x74, 0xf7, 0x47, 0x90, 0xd7, 0xf6, 0x49, 0x5c, 0x91, 0xee, 0xba, 0x79, 0x7e, 0x1f, 0xf3, 0xc6, + 0x5a, 0x08, 0xaa, 0xac, 0x4e, 0x8a, 0x4c, 0x89, 0xbc, 0xc4, 0xa4, 0x3d, 0x4f, 0xb0, 0x45, 0x69, + 0xe2, 0x46, 0x91, 0x21, 0x6f, 0x5a, 0x65, 0x75, 0x3c, 0x70, 0x71, 0x7b, 0x1e, 0x1c, 0x95, 0x54, + 0x92, 0xa5, 0x92, 0x6e, 0xea, 0x55, 0xc1, 0xf1, 0x46, 0xc2, 0x68, 0xb0, 0x6c, 0x54, 0xc3, 0xfd, + 0x57, 0x5d, 0xe4, 0x7b, 0x95, 0x4a, 0x5d, 0xa0, 0xf2, 0x0e, 0x61, 0x47, 0xe3, 0x57, 0x9f, 0x9d, + 0xb2, 0x33, 0x97, 0x77, 0xa3, 0xf7, 0x08, 0x26, 0x1a, 0x65, 0x8e, 0xca, 0xbf, 0x77, 0xca, 0xce, + 0xf6, 0xf9, 0x80, 0xbc, 0x00, 0xf6, 0x14, 0xce, 0x51, 0xb4, 0xa8, 0xfc, 0x1d, 0xcb, 0xac, 0x71, + 0xe7, 0x49, 0x6b, 0x5a, 0x48, 0xe3, 0xbb, 0xbd, 0xa7, 0x47, 0x11, 0x87, 0x43, 0xbb, 0xee, 0xdd, + 0xa2, 0x2c, 0x51, 0x1b, 0x4e, 0x15, 0x7a, 0xcf, 0x61, 0xaf, 0x51, 0xd4, 0x90, 0x4e, 0x2b, 0xbb, + 0xf6, 0x60, 0x76, 0x1c, 0xff, 0x7f, 0x59, 0xdc, 0xe9, 0xae, 0x06, 0xcd, 0x85, 0x7b, 0xf3, 0xe7, + 0xc4, 0xe1, 0x6b, 0x4f, 0xf4, 0x83, 0xc1, 0x03, 0x1b, 0xfa, 0x22, 0xcf, 0x3f, 0x90, 0xc1, 0x4b, + 0x52, 0x36, 0xf7, 0x08, 0x76, 0x5b, 0x32, 0xa8, 0x6c, 0xe8, 0x3e, 0xef, 0x81, 0x77, 0x02, 0x07, + 0xa3, 0xf3, 0x93, 0xc8, 0xed, 0x49, 0x2e, 0x87, 0xf1, 0xd3, 0xeb, 0xdc, 0x9b, 0xc1, 0x84, 0x1a, + 0x23, 0x48, 0xda, 0xa3, 0xa6, 0xb3, 0x60, 0xb3, 0x4c, 0xb7, 0xe3, 0xad, 0x55, 0xf0, 0x41, 0x19, + 0xfd, 0x64, 0x30, 0xb5, 0x15, 0xae, 0x14, 0xb5, 0x42, 0x0b, 0x92, 0xdb, 0xfd, 0x8f, 0x9d, 0x87, + 0x1a, 0x54, 0xa9, 0x21, 0xe5, 0xef, 0xf6, 0x9e, 0x11, 0x47, 0x8f, 0xe1, 0xa1, 0xed, 0xf2, 0x92, + 0x64, 0x21, 0x54, 0x7d, 0x47, 0xa5, 0xe8, 0x33, 0x40, 0x2f, 0xad, 0x52, 0x51, 0x6f, 0xb7, 0xf2, + 0xc5, 0x9b, 0x9b, 0x65, 0xc8, 0x6e, 0x97, 0x21, 0xfb, 0xbb, 0x0c, 0xd9, 0xaf, 0x55, 0xe8, 0xdc, + 0xae, 0x42, 0xe7, 0xf7, 0x2a, 0x74, 0x3e, 0x3e, 0x2d, 0x85, 0xb9, 0x5e, 0x64, 0xf1, 0x9c, 0xea, + 0xe4, 0x52, 0x48, 0x3d, 0xbf, 0x16, 0x69, 0x52, 0x0c, 0xc3, 0x13, 0x9d, 0x7f, 0x49, 0xbe, 0xad, + 0x1f, 0xb0, 0xf9, 0xde, 0xa0, 0xce, 0x26, 0xf6, 0xf1, 0x3e, 0xfb, 0x17, 0x00, 0x00, 0xff, 0xff, + 0x96, 0x66, 0x6c, 0xc3, 0x1e, 0x03, 0x00, 0x00, } func (m *EventTransfer) Marshal() (dAtA []byte, err error) { @@ -372,6 +490,79 @@ func (m *EventTransfer) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *EventSuggestRole) 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 *EventSuggestRole) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventSuggestRole) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Proposal.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintEvent(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *EventAddVoteForRole) 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 *EventAddVoteForRole) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventAddVoteForRole) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Option != 0 { + i = encodeVarintEvent(dAtA, i, uint64(m.Option)) + i-- + dAtA[i] = 0x18 + } + if m.ProposalId != 0 { + i = encodeVarintEvent(dAtA, i, uint64(m.ProposalId)) + i-- + dAtA[i] = 0x10 + } + if len(m.Voter) > 0 { + i -= len(m.Voter) + copy(dAtA[i:], m.Voter) + i = encodeVarintEvent(dAtA, i, uint64(len(m.Voter))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func (m *EventProvision) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -540,6 +731,36 @@ func (m *EventTransfer) Size() (n int) { return n } +func (m *EventSuggestRole) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Proposal.Size() + n += 1 + l + sovEvent(uint64(l)) + return n +} + +func (m *EventAddVoteForRole) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Voter) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + if m.ProposalId != 0 { + n += 1 + sovEvent(uint64(m.ProposalId)) + } + if m.Option != 0 { + n += 1 + sovEvent(uint64(m.Option)) + } + return n +} + func (m *EventProvision) Size() (n int) { if m == nil { return 0 @@ -775,6 +996,209 @@ func (m *EventTransfer) Unmarshal(dAtA []byte) error { } return nil } +func (m *EventSuggestRole) 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: EventSuggestRole: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventSuggestRole: 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 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.Proposal.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 (m *EventAddVoteForRole) 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: EventAddVoteForRole: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventAddVoteForRole: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Voter", 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.Voter = 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 ErrIntOverflowEvent + } + 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) + } + m.Option = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Option |= VoteOption(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 *EventProvision) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/x/fbridge/types/fbridge.go b/x/fbridge/types/fbridge.go new file mode 100644 index 0000000000..fa20ca542e --- /dev/null +++ b/x/fbridge/types/fbridge.go @@ -0,0 +1,39 @@ +package types + +import ( + "errors" +) + +var QueryParamToRole = map[string]Role{ + "unspecified": 0, + "guardian": 1, + "operator": 2, + "judge": 3, +} + +func IsValidRole(role Role) error { + switch role { + case RoleGuardian, RoleOperator, RoleJudge: + return nil + } + + return errors.New("unsupported role") +} + +func IsValidVoteOption(option VoteOption) error { + switch option { + case OptionYes, OptionNo: + return nil + } + + return errors.New("unsupported vote option") +} + +func IsValidBridgeStatus(status BridgeStatus) error { + switch status { + case StatusActive, StatusInactive: + return nil + } + + return errors.New("unsupported bridge status") +} diff --git a/x/fbridge/types/fbridge.pb.go b/x/fbridge/types/fbridge.pb.go index a9b8197a74..e81d70a81b 100644 --- a/x/fbridge/types/fbridge.pb.go +++ b/x/fbridge/types/fbridge.pb.go @@ -8,15 +8,19 @@ import ( github_com_Finschia_finschia_sdk_types "github.com/Finschia/finschia-sdk/types" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" + github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" + _ "google.golang.org/protobuf/types/known/timestamppb" io "io" math "math" math_bits "math/bits" + time "time" ) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal var _ = fmt.Errorf var _ = math.Inf +var _ = time.Kitchen // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -28,10 +32,10 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type Role int32 const ( - Role_UNSPECIFIED Role = 0 - Role_GUARDIAN Role = 1 - Role_OPERATOR Role = 2 - Role_JUDGE Role = 3 + RoleEmpty Role = 0 + RoleGuardian Role = 1 + RoleOperator Role = 2 + RoleJudge Role = 3 ) var Role_name = map[int32]string{ @@ -56,6 +60,69 @@ func (Role) EnumDescriptor() ([]byte, []int) { return fileDescriptor_62374d75fc6aa1ba, []int{0} } +// VoteOption enumerates the valid vote options for a given role proposal. +type VoteOption int32 + +const ( + // VOTE_OPTION_UNSPECIFIED defines a no-op vote option. + OptionEmpty VoteOption = 0 + // VOTE_OPTION_YES defines a yes vote option. + OptionYes VoteOption = 1 + // VOTE_OPTION_NO defines a no vote option. + OptionNo VoteOption = 2 +) + +var VoteOption_name = map[int32]string{ + 0: "VOTE_OPTION_UNSPECIFIED", + 1: "VOTE_OPTION_YES", + 2: "VOTE_OPTION_NO", +} + +var VoteOption_value = map[string]int32{ + "VOTE_OPTION_UNSPECIFIED": 0, + "VOTE_OPTION_YES": 1, + "VOTE_OPTION_NO": 2, +} + +func (x VoteOption) String() string { + return proto.EnumName(VoteOption_name, int32(x)) +} + +func (VoteOption) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_62374d75fc6aa1ba, []int{1} +} + +type BridgeStatus int32 + +const ( + // BRIDGE_STATUS_UNSPECIFIED defines an unspecified bridge status. + StatusEmpty BridgeStatus = 0 + // BRIDGE_STATUS_ACTIVE defines an active bridge status. + StatusActive BridgeStatus = 1 + // BRIDGE_STATUS_INACTIVE defines an inactive bridge status. + StatusInactive BridgeStatus = 2 +) + +var BridgeStatus_name = map[int32]string{ + 0: "BRIDGE_STATUS_UNSPECIFIED", + 1: "BRIDGE_STATUS_ACTIVE", + 2: "BRIDGE_STATUS_INACTIVE", +} + +var BridgeStatus_value = map[string]int32{ + "BRIDGE_STATUS_UNSPECIFIED": 0, + "BRIDGE_STATUS_ACTIVE": 1, + "BRIDGE_STATUS_INACTIVE": 2, +} + +func (x BridgeStatus) String() string { + return proto.EnumName(BridgeStatus_name, int32(x)) +} + +func (BridgeStatus) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_62374d75fc6aa1ba, []int{2} +} + 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"` @@ -322,6 +389,58 @@ func (m *Fraction) GetDenominator() uint64 { return 0 } +type RolePair struct { + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + Role Role `protobuf:"varint,2,opt,name=role,proto3,enum=lbm.fbridge.v1.Role" json:"role,omitempty"` +} + +func (m *RolePair) Reset() { *m = RolePair{} } +func (m *RolePair) String() string { return proto.CompactTextString(m) } +func (*RolePair) ProtoMessage() {} +func (*RolePair) Descriptor() ([]byte, []int) { + return fileDescriptor_62374d75fc6aa1ba, []int{4} +} +func (m *RolePair) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RolePair) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RolePair.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 *RolePair) XXX_Merge(src proto.Message) { + xxx_messageInfo_RolePair.Merge(m, src) +} +func (m *RolePair) XXX_Size() int { + return m.Size() +} +func (m *RolePair) XXX_DiscardUnknown() { + xxx_messageInfo_RolePair.DiscardUnknown(m) +} + +var xxx_messageInfo_RolePair proto.InternalMessageInfo + +func (m *RolePair) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +func (m *RolePair) GetRole() Role { + if m != nil { + return m.Role + } + return RoleEmpty +} + type RoleProposal struct { Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` // the proposer address @@ -335,14 +454,14 @@ type RoleProposal struct { // - 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"` + ExpiredAt time.Time `protobuf:"bytes,5,opt,name=expired_at,json=expiredAt,proto3,stdtime" json:"expired_at"` } 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} + return fileDescriptor_62374d75fc6aa1ba, []int{5} } func (m *RoleProposal) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -396,68 +515,276 @@ func (m *RoleProposal) GetRole() Role { if m != nil { return m.Role } - return Role_UNSPECIFIED + return RoleEmpty } -func (m *RoleProposal) GetExpiredAt() uint64 { +func (m *RoleProposal) GetExpiredAt() time.Time { if m != nil { return m.ExpiredAt } + return time.Time{} +} + +// Vote defines a vote on a role proposal. +type Vote struct { + ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` + Voter string `protobuf:"bytes,2,opt,name=voter,proto3" json:"voter,omitempty"` + Option VoteOption `protobuf:"varint,3,opt,name=option,proto3,enum=lbm.fbridge.v1.VoteOption" json:"option,omitempty"` +} + +func (m *Vote) Reset() { *m = Vote{} } +func (m *Vote) String() string { return proto.CompactTextString(m) } +func (*Vote) ProtoMessage() {} +func (*Vote) Descriptor() ([]byte, []int) { + return fileDescriptor_62374d75fc6aa1ba, []int{6} +} +func (m *Vote) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Vote) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Vote.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 *Vote) XXX_Merge(src proto.Message) { + xxx_messageInfo_Vote.Merge(m, src) +} +func (m *Vote) XXX_Size() int { + return m.Size() +} +func (m *Vote) XXX_DiscardUnknown() { + xxx_messageInfo_Vote.DiscardUnknown(m) +} + +var xxx_messageInfo_Vote proto.InternalMessageInfo + +func (m *Vote) GetProposalId() uint64 { + if m != nil { + return m.ProposalId + } + return 0 +} + +func (m *Vote) GetVoter() string { + if m != nil { + return m.Voter + } + return "" +} + +func (m *Vote) GetOption() VoteOption { + if m != nil { + return m.Option + } + return OptionEmpty +} + +// RoleMetadata defines the metadata of the role. +type RoleMetadata struct { + // the number of registered guardians + Guardian uint64 `protobuf:"varint,1,opt,name=guardian,proto3" json:"guardian,omitempty"` + // the number of the operators + Operator uint64 `protobuf:"varint,2,opt,name=operator,proto3" json:"operator,omitempty"` + // the number of the judges + Judge uint64 `protobuf:"varint,3,opt,name=judge,proto3" json:"judge,omitempty"` +} + +func (m *RoleMetadata) Reset() { *m = RoleMetadata{} } +func (m *RoleMetadata) String() string { return proto.CompactTextString(m) } +func (*RoleMetadata) ProtoMessage() {} +func (*RoleMetadata) Descriptor() ([]byte, []int) { + return fileDescriptor_62374d75fc6aa1ba, []int{7} +} +func (m *RoleMetadata) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RoleMetadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RoleMetadata.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 *RoleMetadata) XXX_Merge(src proto.Message) { + xxx_messageInfo_RoleMetadata.Merge(m, src) +} +func (m *RoleMetadata) XXX_Size() int { + return m.Size() +} +func (m *RoleMetadata) XXX_DiscardUnknown() { + xxx_messageInfo_RoleMetadata.DiscardUnknown(m) +} + +var xxx_messageInfo_RoleMetadata proto.InternalMessageInfo + +func (m *RoleMetadata) GetGuardian() uint64 { + if m != nil { + return m.Guardian + } + return 0 +} + +func (m *RoleMetadata) GetOperator() uint64 { + if m != nil { + return m.Operator + } + return 0 +} + +func (m *RoleMetadata) GetJudge() uint64 { + if m != nil { + return m.Judge + } + return 0 +} + +// BridgeStatusMetadata defines the metadata of the bridge status. +type BridgeStatusMetadata struct { + // the number of inactived bridge switch + Inactive uint64 `protobuf:"varint,1,opt,name=inactive,proto3" json:"inactive,omitempty"` + // the number of activated bridge switch + Active uint64 `protobuf:"varint,2,opt,name=active,proto3" json:"active,omitempty"` +} + +func (m *BridgeStatusMetadata) Reset() { *m = BridgeStatusMetadata{} } +func (m *BridgeStatusMetadata) String() string { return proto.CompactTextString(m) } +func (*BridgeStatusMetadata) ProtoMessage() {} +func (*BridgeStatusMetadata) Descriptor() ([]byte, []int) { + return fileDescriptor_62374d75fc6aa1ba, []int{8} +} +func (m *BridgeStatusMetadata) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BridgeStatusMetadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BridgeStatusMetadata.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 *BridgeStatusMetadata) XXX_Merge(src proto.Message) { + xxx_messageInfo_BridgeStatusMetadata.Merge(m, src) +} +func (m *BridgeStatusMetadata) XXX_Size() int { + return m.Size() +} +func (m *BridgeStatusMetadata) XXX_DiscardUnknown() { + xxx_messageInfo_BridgeStatusMetadata.DiscardUnknown(m) +} + +var xxx_messageInfo_BridgeStatusMetadata proto.InternalMessageInfo + +func (m *BridgeStatusMetadata) GetInactive() uint64 { + if m != nil { + return m.Inactive + } + return 0 +} + +func (m *BridgeStatusMetadata) GetActive() uint64 { + if m != nil { + return m.Active + } return 0 } func init() { proto.RegisterEnum("lbm.fbridge.v1.Role", Role_name, Role_value) + proto.RegisterEnum("lbm.fbridge.v1.VoteOption", VoteOption_name, VoteOption_value) + proto.RegisterEnum("lbm.fbridge.v1.BridgeStatus", BridgeStatus_name, BridgeStatus_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((*RolePair)(nil), "lbm.fbridge.v1.RolePair") proto.RegisterType((*RoleProposal)(nil), "lbm.fbridge.v1.RoleProposal") + proto.RegisterType((*Vote)(nil), "lbm.fbridge.v1.Vote") + proto.RegisterType((*RoleMetadata)(nil), "lbm.fbridge.v1.RoleMetadata") + proto.RegisterType((*BridgeStatusMetadata)(nil), "lbm.fbridge.v1.BridgeStatusMetadata") } 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, + // 973 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x55, 0x4f, 0x6f, 0xe3, 0x44, + 0x14, 0x8f, 0xb3, 0x6e, 0x49, 0x5e, 0xda, 0x34, 0x8c, 0xa2, 0xa5, 0x58, 0x4b, 0x12, 0x22, 0x21, + 0xaa, 0x0a, 0x1c, 0x36, 0xdc, 0xb8, 0x25, 0xad, 0x5b, 0x39, 0x82, 0x24, 0x72, 0xd3, 0x4a, 0x8b, + 0x90, 0x22, 0x27, 0x9e, 0x66, 0x87, 0xb5, 0x3d, 0x66, 0x3c, 0x09, 0xbb, 0x7c, 0x00, 0x84, 0x7a, + 0xda, 0x2f, 0x50, 0x69, 0x11, 0x9f, 0x84, 0xdb, 0x8a, 0xd3, 0x1e, 0x11, 0x87, 0x05, 0xb5, 0x17, + 0x3e, 0x06, 0x9a, 0x19, 0x8f, 0x9b, 0xac, 0x90, 0x76, 0x6f, 0xf3, 0xde, 0xfc, 0xde, 0xef, 0xfd, + 0xde, 0x9f, 0xb1, 0xe1, 0x41, 0x38, 0x8b, 0x3a, 0x97, 0x33, 0x46, 0x82, 0x05, 0xee, 0xac, 0x1e, + 0xea, 0xa3, 0x9d, 0x30, 0xca, 0x29, 0xaa, 0x86, 0xb3, 0xc8, 0xd6, 0xae, 0xd5, 0x43, 0xab, 0xb9, + 0xa0, 0x74, 0x11, 0xe2, 0x8e, 0xbc, 0x9d, 0x2d, 0x2f, 0x3b, 0x9c, 0x44, 0x38, 0xe5, 0x7e, 0x94, + 0xa8, 0x00, 0xab, 0xbe, 0xa0, 0x0b, 0x2a, 0x8f, 0x1d, 0x71, 0x52, 0xde, 0xf6, 0x1f, 0x45, 0xd8, + 0x1e, 0xfb, 0xcc, 0x8f, 0x52, 0x34, 0x86, 0x3a, 0x4d, 0x30, 0xf3, 0x39, 0x65, 0x53, 0xce, 0x96, + 0x29, 0x9f, 0x86, 0x78, 0x85, 0xc3, 0x7d, 0xa3, 0x65, 0x1c, 0x54, 0xba, 0xfb, 0xf6, 0x66, 0x42, + 0xfb, 0x84, 0xf9, 0x73, 0x4e, 0x68, 0xdc, 0x37, 0x5f, 0xbe, 0x6e, 0x16, 0x3c, 0xa4, 0x63, 0x27, + 0x22, 0xf4, 0x6b, 0x11, 0x29, 0x18, 0x17, 0x4b, 0x9f, 0x05, 0xc4, 0x8f, 0x37, 0x18, 0x8b, 0xef, + 0xc6, 0xa8, 0x63, 0xd7, 0x18, 0x07, 0xf0, 0xfe, 0xf7, 0xcb, 0x60, 0x81, 0x37, 0xe8, 0xee, 0xbd, + 0x13, 0xdd, 0x9e, 0x0c, 0x5c, 0xe3, 0xfa, 0x14, 0xf6, 0x44, 0x8f, 0x42, 0x3a, 0x7f, 0x32, 0x4d, + 0x30, 0x23, 0x34, 0xd8, 0x37, 0x5b, 0xc6, 0x81, 0xe9, 0x55, 0xb5, 0x7b, 0x2c, 0xbd, 0x02, 0x98, + 0x30, 0x9a, 0xd0, 0xd4, 0x0f, 0x35, 0x70, 0x4b, 0x01, 0xb5, 0x5b, 0x01, 0xdb, 0xbf, 0x1a, 0xb0, + 0x3b, 0x66, 0x74, 0x45, 0x52, 0x42, 0xe3, 0x63, 0x9f, 0xfb, 0xa8, 0x06, 0xf7, 0x52, 0xfc, 0x83, + 0x6c, 0xa1, 0xe9, 0x89, 0x23, 0x1a, 0xc0, 0xb6, 0x1f, 0xd1, 0x65, 0xcc, 0x65, 0x17, 0xca, 0xfd, + 0xae, 0x10, 0xf7, 0xd7, 0xeb, 0xe6, 0xe1, 0x82, 0xf0, 0xc7, 0xcb, 0x99, 0x3d, 0xa7, 0x51, 0xe7, + 0x84, 0xc4, 0xe9, 0xfc, 0x31, 0xf1, 0x3b, 0x97, 0xd9, 0xe1, 0xf3, 0x34, 0x78, 0xd2, 0xe1, 0xcf, + 0x12, 0x9c, 0xda, 0x6e, 0xcc, 0xbd, 0x8c, 0x01, 0xdd, 0x87, 0xed, 0x14, 0xc7, 0x01, 0x66, 0xb2, + 0x05, 0x65, 0x2f, 0xb3, 0x90, 0x05, 0x25, 0x86, 0xe7, 0x98, 0xac, 0x30, 0x93, 0x25, 0x95, 0xbd, + 0xdc, 0x6e, 0xff, 0x04, 0x7b, 0xb9, 0xc4, 0x33, 0xee, 0xf3, 0x65, 0x8a, 0x3e, 0x86, 0x9d, 0xbc, + 0x11, 0x38, 0x0e, 0x32, 0xb5, 0x15, 0xed, 0x73, 0xe2, 0x00, 0x7d, 0x02, 0xd5, 0x39, 0x8d, 0x2f, + 0x09, 0x8b, 0xa6, 0x73, 0x91, 0x3a, 0x95, 0xea, 0xb7, 0xbc, 0xdd, 0xcc, 0x7b, 0x24, 0x9d, 0xe8, + 0x23, 0x00, 0x92, 0x4e, 0xe7, 0xa1, 0x4f, 0x22, 0x1c, 0x48, 0x51, 0x25, 0xaf, 0x4c, 0xd2, 0x23, + 0xe5, 0x68, 0x0f, 0xa0, 0xa4, 0x87, 0x82, 0x1e, 0x40, 0x39, 0x5e, 0x46, 0x6a, 0x65, 0xb2, 0x8c, + 0x77, 0x0e, 0xd4, 0x82, 0x4a, 0x80, 0x63, 0x1a, 0x91, 0x58, 0xde, 0x17, 0x95, 0xa2, 0x35, 0x57, + 0x7b, 0x08, 0x25, 0x8f, 0x86, 0x78, 0xec, 0x13, 0x86, 0xf6, 0xe1, 0x3d, 0x3f, 0x08, 0x18, 0x4e, + 0x53, 0xc9, 0x54, 0xf6, 0xb4, 0x89, 0x0e, 0xc0, 0x64, 0x34, 0xc4, 0x92, 0xa0, 0xda, 0xad, 0xbf, + 0xb9, 0x22, 0x82, 0xc1, 0x93, 0x88, 0xf6, 0xef, 0x06, 0xec, 0x48, 0xc2, 0x6c, 0xa4, 0xa8, 0x0a, + 0x45, 0xa2, 0x7b, 0x51, 0x24, 0x81, 0x68, 0xaa, 0x1a, 0x37, 0x56, 0x7a, 0xca, 0x5e, 0x6e, 0x8b, + 0x41, 0x70, 0x9f, 0x2d, 0x30, 0xd7, 0x83, 0x50, 0x56, 0x9e, 0xde, 0x7c, 0x5b, 0x7a, 0x74, 0x04, + 0x80, 0x9f, 0x26, 0x84, 0xe1, 0x60, 0xea, 0x73, 0xb9, 0x5e, 0x95, 0xae, 0x65, 0xab, 0x37, 0x6d, + 0xeb, 0x37, 0x6d, 0x4f, 0xf4, 0x9b, 0xee, 0x97, 0xc4, 0xda, 0x3c, 0xff, 0xbb, 0x69, 0x78, 0xe5, + 0x2c, 0xae, 0xc7, 0xdb, 0x3f, 0x82, 0x79, 0x41, 0x39, 0x46, 0x4d, 0xa8, 0xe4, 0x0b, 0x9b, 0xd7, + 0x00, 0xda, 0xe5, 0x06, 0xa8, 0x0e, 0x5b, 0x2b, 0xca, 0xf3, 0x42, 0x94, 0x81, 0xba, 0xb0, 0x4d, + 0x13, 0x31, 0x1c, 0x59, 0x45, 0xb5, 0x6b, 0xbd, 0xa9, 0x57, 0x90, 0x8f, 0x24, 0xc2, 0xcb, 0x90, + 0x5f, 0x99, 0xff, 0xbe, 0x68, 0x16, 0xda, 0xdf, 0xa9, 0xde, 0x7d, 0x83, 0xb9, 0x1f, 0x88, 0xb5, + 0xb7, 0xa0, 0xa4, 0x1f, 0x6f, 0x96, 0x3d, 0xb7, 0xc5, 0x9d, 0xfe, 0x54, 0x64, 0x73, 0xcd, 0x6d, + 0xa1, 0x4b, 0xbe, 0x52, 0x29, 0xc0, 0xf4, 0x94, 0xd1, 0x1e, 0x40, 0xbd, 0x2f, 0x35, 0xa8, 0x7d, + 0x5d, 0xcf, 0x42, 0x62, 0xb1, 0x4e, 0x2b, 0xac, 0xb3, 0x68, 0x5b, 0x4c, 0x24, 0xbb, 0x51, 0x39, + 0x32, 0xeb, 0xf0, 0x67, 0x03, 0x4c, 0x21, 0x15, 0x35, 0xa0, 0x72, 0x3e, 0x3c, 0x1b, 0x3b, 0x47, + 0xee, 0x89, 0xeb, 0x1c, 0xd7, 0x0a, 0xd6, 0xee, 0xd5, 0x75, 0xab, 0x2c, 0xae, 0x9c, 0x28, 0xe1, + 0xcf, 0x50, 0x03, 0x4a, 0xa7, 0xe7, 0x3d, 0xef, 0xd8, 0xed, 0x0d, 0x6b, 0x86, 0x55, 0xbb, 0xba, + 0x6e, 0xc9, 0x12, 0x4f, 0x75, 0x19, 0x0d, 0x28, 0x8d, 0xc6, 0x8e, 0xd7, 0x9b, 0x8c, 0xbc, 0x5a, + 0xf1, 0xee, 0x7e, 0xa4, 0x4b, 0xd9, 0x87, 0xad, 0xc1, 0xf9, 0xf1, 0xa9, 0x53, 0xbb, 0x77, 0xc7, + 0x3c, 0x10, 0xe5, 0x58, 0xe6, 0x2f, 0xbf, 0x35, 0x0a, 0x42, 0x08, 0xdc, 0xf5, 0x13, 0x7d, 0x06, + 0x1f, 0x5c, 0x8c, 0x26, 0xce, 0x74, 0x34, 0x9e, 0xb8, 0xa3, 0xe1, 0x74, 0x53, 0xda, 0xde, 0xd5, + 0x75, 0xab, 0xa2, 0x80, 0x4a, 0x5c, 0x1b, 0xf6, 0xd6, 0xd1, 0x8f, 0x9c, 0xb3, 0x9a, 0xa1, 0xd2, + 0x28, 0xd4, 0x23, 0x9c, 0xa2, 0x16, 0x54, 0xd7, 0x31, 0xc3, 0x51, 0xad, 0x68, 0xed, 0x5c, 0x5d, + 0xb7, 0x4a, 0x0a, 0x32, 0xa4, 0x99, 0x90, 0x17, 0x06, 0xec, 0xac, 0xb7, 0x17, 0xd9, 0xf0, 0x61, + 0xdf, 0x73, 0x8f, 0x4f, 0x9d, 0xe9, 0xd9, 0xa4, 0x37, 0x39, 0x3f, 0xfb, 0x3f, 0x31, 0x0a, 0xaa, + 0xc4, 0x1c, 0x42, 0x7d, 0x13, 0xdf, 0x3b, 0x9a, 0xb8, 0x17, 0x8e, 0xee, 0x9a, 0x82, 0xf6, 0xd4, + 0x58, 0x6c, 0xb8, 0xbf, 0x89, 0x75, 0x87, 0x19, 0xba, 0x68, 0xa1, 0xab, 0xeb, 0x56, 0x55, 0xa1, + 0xdd, 0x6c, 0x8c, 0x4a, 0x62, 0x7f, 0xf0, 0xf2, 0xa6, 0x61, 0xbc, 0xba, 0x69, 0x18, 0xff, 0xdc, + 0x34, 0x8c, 0xe7, 0xb7, 0x8d, 0xc2, 0xab, 0xdb, 0x46, 0xe1, 0xcf, 0xdb, 0x46, 0xe1, 0xdb, 0x2f, + 0xde, 0xfa, 0xd5, 0x7c, 0x9a, 0xff, 0x42, 0xe5, 0xf7, 0x73, 0xb6, 0x2d, 0x1f, 0xd3, 0x97, 0xff, + 0x05, 0x00, 0x00, 0xff, 0xff, 0xfa, 0x2c, 0x09, 0x1f, 0x5e, 0x07, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -651,6 +978,41 @@ func (m *Fraction) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *RolePair) 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 *RolePair) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RolePair) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Role != 0 { + i = encodeVarintFbridge(dAtA, i, uint64(m.Role)) + i-- + dAtA[i] = 0x10 + } + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintFbridge(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func (m *RoleProposal) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -671,11 +1033,14 @@ func (m *RoleProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.ExpiredAt != 0 { - i = encodeVarintFbridge(dAtA, i, uint64(m.ExpiredAt)) - i-- - dAtA[i] = 0x28 + n4, err4 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.ExpiredAt, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.ExpiredAt):]) + if err4 != nil { + return 0, err4 } + i -= n4 + i = encodeVarintFbridge(dAtA, i, uint64(n4)) + i-- + dAtA[i] = 0x2a if m.Role != 0 { i = encodeVarintFbridge(dAtA, i, uint64(m.Role)) i-- @@ -703,46 +1068,157 @@ func (m *RoleProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { 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++ +func (m *Vote) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - dAtA[offset] = uint8(v) - return base + return dAtA[:n], nil } -func (m *Params) Size() (n int) { - if m == nil { - return 0 - } + +func (m *Vote) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Vote) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i 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.Option != 0 { + i = encodeVarintFbridge(dAtA, i, uint64(m.Option)) + i-- + dAtA[i] = 0x18 } - if m.ProposalPeriod != 0 { - n += 1 + sovFbridge(uint64(m.ProposalPeriod)) + if len(m.Voter) > 0 { + i -= len(m.Voter) + copy(dAtA[i:], m.Voter) + i = encodeVarintFbridge(dAtA, i, uint64(len(m.Voter))) + i-- + dAtA[i] = 0x12 } - return n + if m.ProposalId != 0 { + i = encodeVarintFbridge(dAtA, i, uint64(m.ProposalId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil } -func (m *ProvisionData) Size() (n int) { - if m == nil { - return 0 +func (m *RoleMetadata) 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 *RoleMetadata) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RoleMetadata) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if m.Seq != 0 { - n += 1 + sovFbridge(uint64(m.Seq)) + if m.Judge != 0 { + i = encodeVarintFbridge(dAtA, i, uint64(m.Judge)) + i-- + dAtA[i] = 0x18 + } + if m.Operator != 0 { + i = encodeVarintFbridge(dAtA, i, uint64(m.Operator)) + i-- + dAtA[i] = 0x10 + } + if m.Guardian != 0 { + i = encodeVarintFbridge(dAtA, i, uint64(m.Guardian)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *BridgeStatusMetadata) 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 *BridgeStatusMetadata) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BridgeStatusMetadata) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Active != 0 { + i = encodeVarintFbridge(dAtA, i, uint64(m.Active)) + i-- + dAtA[i] = 0x10 + } + if m.Inactive != 0 { + i = encodeVarintFbridge(dAtA, i, uint64(m.Inactive)) + 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)) @@ -790,6 +1266,22 @@ func (m *Fraction) Size() (n int) { return n } +func (m *RolePair) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovFbridge(uint64(l)) + } + if m.Role != 0 { + n += 1 + sovFbridge(uint64(m.Role)) + } + return n +} + func (m *RoleProposal) Size() (n int) { if m == nil { return 0 @@ -810,8 +1302,59 @@ func (m *RoleProposal) Size() (n int) { if m.Role != 0 { n += 1 + sovFbridge(uint64(m.Role)) } - if m.ExpiredAt != 0 { - n += 1 + sovFbridge(uint64(m.ExpiredAt)) + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.ExpiredAt) + n += 1 + l + sovFbridge(uint64(l)) + return n +} + +func (m *Vote) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ProposalId != 0 { + n += 1 + sovFbridge(uint64(m.ProposalId)) + } + l = len(m.Voter) + if l > 0 { + n += 1 + l + sovFbridge(uint64(l)) + } + if m.Option != 0 { + n += 1 + sovFbridge(uint64(m.Option)) + } + return n +} + +func (m *RoleMetadata) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Guardian != 0 { + n += 1 + sovFbridge(uint64(m.Guardian)) + } + if m.Operator != 0 { + n += 1 + sovFbridge(uint64(m.Operator)) + } + if m.Judge != 0 { + n += 1 + sovFbridge(uint64(m.Judge)) + } + return n +} + +func (m *BridgeStatusMetadata) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Inactive != 0 { + n += 1 + sovFbridge(uint64(m.Inactive)) + } + if m.Active != 0 { + n += 1 + sovFbridge(uint64(m.Active)) } return n } @@ -1372,6 +1915,107 @@ func (m *Fraction) Unmarshal(dAtA []byte) error { } return nil } +func (m *RolePair) 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: RolePair: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RolePair: 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 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.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + 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 + } + } + 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 @@ -1504,10 +2148,339 @@ func (m *RoleProposal) Unmarshal(dAtA []byte) error { } } case 5: - if wireType != 0 { + if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ExpiredAt", wireType) } - m.ExpiredAt = 0 + 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 := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.ExpiredAt, dAtA[iNdEx:postIndex]); err != nil { + return err + } + 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 *Vote) 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: Vote: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Vote: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + 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 ErrIntOverflowFbridge + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProposalId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Voter", 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.Voter = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Option", wireType) + } + m.Option = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFbridge + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Option |= VoteOption(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 *RoleMetadata) 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: RoleMetadata: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RoleMetadata: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Guardian", wireType) + } + m.Guardian = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFbridge + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Guardian |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Operator", wireType) + } + m.Operator = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFbridge + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Operator |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Judge", wireType) + } + m.Judge = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFbridge + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Judge |= 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 *BridgeStatusMetadata) 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: BridgeStatusMetadata: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BridgeStatusMetadata: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Inactive", wireType) + } + m.Inactive = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFbridge + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Inactive |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Active", wireType) + } + m.Active = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowFbridge @@ -1517,7 +2490,7 @@ func (m *RoleProposal) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.ExpiredAt |= uint64(b&0x7F) << shift + m.Active |= uint64(b&0x7F) << shift if b < 0x80 { break } diff --git a/x/fbridge/types/genesis.go b/x/fbridge/types/genesis.go index 07af6f9677..358f64b2fa 100644 --- a/x/fbridge/types/genesis.go +++ b/x/fbridge/types/genesis.go @@ -5,26 +5,104 @@ import ( sdk "github.com/Finschia/finschia-sdk/types" authtypes "github.com/Finschia/finschia-sdk/x/auth/types" + foundationtypes "github.com/Finschia/finschia-sdk/x/foundation" govtypes "github.com/Finschia/finschia-sdk/x/gov/types" ) func DefaultGenesisState() *GenesisState { return &GenesisState{ + Params: DefaultParams(), SendingState: SendingState{ NextSeq: 1, }, - ReceivingState: ReceivingState{}, + ReceivingState: ReceivingState{}, + NextRoleProposalId: 1, + } +} + +func DefaultAuthority() sdk.AccAddress { + return authtypes.NewModuleAddress(govtypes.ModuleName) +} + +func AuthorityCandiates() []sdk.AccAddress { + return []sdk.AccAddress{ + authtypes.NewModuleAddress(govtypes.ModuleName), + authtypes.NewModuleAddress(foundationtypes.ModuleName), } } func ValidateGenesis(data GenesisState) error { - if data.SendingState.NextSeq < 1 { - panic(errors.New("next sequence must be positive")) + if err := ValidateParams(data.Params); err != nil { + return err + } + + if err := validateSendingState(data.SendingState); err != nil { + return err + } + + if data.NextRoleProposalId < 1 { + return errors.New("next role proposal ID must be positive") + } + + for _, v := range data.RoleProposals { + if v.Id < 1 { + return errors.New("role proposal ID must be positive") + } + sdk.MustAccAddressFromBech32(v.Proposer) + sdk.MustAccAddressFromBech32(v.Target) + if err := IsValidRole(v.Role); err != nil { + return err + } + } + + for _, v := range data.Votes { + if v.ProposalId < 1 { + return errors.New("role proposal ID must be positive") + } + sdk.MustAccAddressFromBech32(v.Voter) + if err := IsValidVoteOption(v.Option); err != nil { + return err + } + } + + for _, v := range data.Roles { + sdk.MustAccAddressFromBech32(v.Address) + if err := IsValidRole(v.Role); err != nil { + return err + } + } + + for _, v := range data.BridgeSwitches { + sdk.MustAccAddressFromBech32(v.Guardian) + if err := IsValidBridgeStatus(v.Status); err != nil { + return err + } } return nil } -func DefaultAuthority() sdk.AccAddress { - return authtypes.NewModuleAddress(govtypes.ModuleName) +func validateSendingState(state SendingState) error { + if state.NextSeq < 1 { + return errors.New("next sequence must be positive") + } + + if state.NextSeq-1 != uint64(len(state.SeqToBlocknum)) { + return errors.New("sequence to blocknum mapping is invalid") + } + + chkSeq := make(map[uint64]struct{}) + for _, v := range state.SeqToBlocknum { + if v.Blocknum == 0 || v.Seq == 0 { + return errors.New("blocknum and seq must be positive") + } + + if _, ok := chkSeq[v.Seq]; ok { + return errors.New("duplicate sequence") + } + + chkSeq[v.Seq] = struct{}{} + } + + return nil } diff --git a/x/fbridge/types/genesis.pb.go b/x/fbridge/types/genesis.pb.go index 7b28e12f13..844eb131ae 100644 --- a/x/fbridge/types/genesis.pb.go +++ b/x/fbridge/types/genesis.pb.go @@ -31,6 +31,16 @@ type GenesisState struct { 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"` + // next_role_proposal_id is the next role proposal ID to be used. + NextRoleProposalId uint64 `protobuf:"varint,4,opt,name=next_role_proposal_id,json=nextRoleProposalId,proto3" json:"next_role_proposal_id,omitempty"` + // role_proposals defines all the role proposals present at genesis. + RoleProposals []RoleProposal `protobuf:"bytes,5,rep,name=role_proposals,json=roleProposals,proto3" json:"role_proposals"` + // votes defines all the votes present for role proposals at genesis. + Votes []Vote `protobuf:"bytes,6,rep,name=votes,proto3" json:"votes"` + // roles defines all addresses assigned roles at genesis. + Roles []RolePair `protobuf:"bytes,7,rep,name=roles,proto3" json:"roles"` + // bridge_switches defines the status of whether each guardian has allowed the bridge to operate. + BridgeSwitches []BridgeSwitch `protobuf:"bytes,8,rep,name=bridge_switches,json=bridgeSwitches,proto3" json:"bridge_switches"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -87,6 +97,41 @@ func (m *GenesisState) GetReceivingState() ReceivingState { return ReceivingState{} } +func (m *GenesisState) GetNextRoleProposalId() uint64 { + if m != nil { + return m.NextRoleProposalId + } + return 0 +} + +func (m *GenesisState) GetRoleProposals() []RoleProposal { + if m != nil { + return m.RoleProposals + } + return nil +} + +func (m *GenesisState) GetVotes() []Vote { + if m != nil { + return m.Votes + } + return nil +} + +func (m *GenesisState) GetRoles() []RolePair { + if m != nil { + return m.Roles + } + return nil +} + +func (m *GenesisState) GetBridgeSwitches() []BridgeSwitch { + if m != nil { + return m.BridgeSwitches + } + return nil +} + 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"` @@ -461,6 +506,59 @@ func (m *ConfirmedProvision) GetCommitment() string { return "" } +type BridgeSwitch struct { + // the guardian address + Guardian string `protobuf:"bytes,1,opt,name=guardian,proto3" json:"guardian,omitempty"` + Status BridgeStatus `protobuf:"varint,2,opt,name=status,proto3,enum=lbm.fbridge.v1.BridgeStatus" json:"status,omitempty"` +} + +func (m *BridgeSwitch) Reset() { *m = BridgeSwitch{} } +func (m *BridgeSwitch) String() string { return proto.CompactTextString(m) } +func (*BridgeSwitch) ProtoMessage() {} +func (*BridgeSwitch) Descriptor() ([]byte, []int) { + return fileDescriptor_0fc3cc4535a29f6d, []int{8} +} +func (m *BridgeSwitch) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BridgeSwitch) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BridgeSwitch.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 *BridgeSwitch) XXX_Merge(src proto.Message) { + xxx_messageInfo_BridgeSwitch.Merge(m, src) +} +func (m *BridgeSwitch) XXX_Size() int { + return m.Size() +} +func (m *BridgeSwitch) XXX_DiscardUnknown() { + xxx_messageInfo_BridgeSwitch.DiscardUnknown(m) +} + +var xxx_messageInfo_BridgeSwitch proto.InternalMessageInfo + +func (m *BridgeSwitch) GetGuardian() string { + if m != nil { + return m.Guardian + } + return "" +} + +func (m *BridgeSwitch) GetStatus() BridgeStatus { + if m != nil { + return m.Status + } + return StatusEmpty +} + func init() { proto.RegisterType((*GenesisState)(nil), "lbm.fbridge.v1.GenesisState") proto.RegisterType((*SendingState)(nil), "lbm.fbridge.v1.SendingState") @@ -470,54 +568,64 @@ func init() { proto.RegisterType((*Commitment)(nil), "lbm.fbridge.v1.Commitment") proto.RegisterType((*Provision)(nil), "lbm.fbridge.v1.Provision") proto.RegisterType((*ConfirmedProvision)(nil), "lbm.fbridge.v1.ConfirmedProvision") + proto.RegisterType((*BridgeSwitch)(nil), "lbm.fbridge.v1.BridgeSwitch") } 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, + // 808 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x55, 0xcf, 0x8f, 0xdb, 0x44, + 0x14, 0x8e, 0x13, 0x6f, 0xba, 0x7d, 0x4d, 0x93, 0x6a, 0xd4, 0x56, 0x6e, 0x28, 0x4e, 0x64, 0x71, + 0xc8, 0x01, 0x92, 0x06, 0x2a, 0xf1, 0x43, 0x95, 0x90, 0xb2, 0xa8, 0xd5, 0x16, 0x21, 0x2a, 0x1b, + 0x21, 0xd4, 0x8b, 0x19, 0xdb, 0x13, 0xef, 0xa8, 0xb1, 0xc7, 0xf1, 0x4c, 0x42, 0x57, 0xfc, 0x03, + 0xdc, 0xe0, 0xc6, 0x95, 0x0b, 0xff, 0x4b, 0x8f, 0x7b, 0xe4, 0x84, 0xd0, 0xee, 0x3f, 0x82, 0x66, + 0x32, 0x76, 0x1c, 0x27, 0x91, 0xe0, 0x36, 0x33, 0xef, 0x7b, 0xdf, 0xfb, 0xe6, 0xf9, 0xf3, 0x1b, + 0x78, 0xbc, 0x08, 0x92, 0xc9, 0x3c, 0xc8, 0x69, 0x14, 0x93, 0xc9, 0x7a, 0x3a, 0x89, 0x49, 0x4a, + 0x38, 0xe5, 0xe3, 0x2c, 0x67, 0x82, 0xa1, 0xee, 0x22, 0x48, 0xc6, 0x3a, 0x3a, 0x5e, 0x4f, 0xfb, + 0xf7, 0x63, 0x16, 0x33, 0x15, 0x9a, 0xc8, 0xd5, 0x06, 0xd5, 0xaf, 0x73, 0x14, 0x09, 0x2a, 0xea, + 0xfc, 0x6a, 0x42, 0xe7, 0xc5, 0x86, 0xd5, 0x13, 0x58, 0x10, 0xf4, 0x14, 0xda, 0x19, 0xce, 0x71, + 0xc2, 0x2d, 0x63, 0x68, 0x8c, 0xee, 0x7c, 0xfc, 0x70, 0xbc, 0x5b, 0x65, 0xfc, 0x4a, 0x45, 0x67, + 0xe6, 0xbb, 0xbf, 0x07, 0x0d, 0x57, 0x63, 0xd1, 0x0b, 0xb8, 0xcb, 0x49, 0x1a, 0xd1, 0x34, 0xf6, + 0xb9, 0xa4, 0xb1, 0x9a, 0x2a, 0xf9, 0x71, 0x3d, 0xd9, 0xdb, 0x80, 0x54, 0x29, 0x4d, 0xd1, 0xe1, + 0x95, 0x33, 0xf4, 0x0d, 0xf4, 0x72, 0x12, 0x12, 0xba, 0xde, 0x52, 0xb5, 0x14, 0x95, 0x5d, 0xa7, + 0x72, 0x0b, 0x58, 0x95, 0xac, 0x9b, 0xef, 0x9c, 0xa2, 0x29, 0x3c, 0x48, 0xc9, 0x5b, 0xe1, 0xe7, + 0x6c, 0x41, 0xfc, 0x2c, 0x67, 0x19, 0xe3, 0x78, 0xe1, 0xd3, 0xc8, 0x32, 0x87, 0xc6, 0xc8, 0x74, + 0x91, 0x0c, 0xba, 0x6c, 0x41, 0x5e, 0xe9, 0xd0, 0x79, 0x84, 0xce, 0xa1, 0xbb, 0x83, 0xe6, 0xd6, + 0xc9, 0xb0, 0x75, 0xe8, 0x2e, 0xd5, 0x3c, 0x5d, 0xfe, 0x6e, 0x5e, 0x39, 0xe3, 0xe8, 0x09, 0x9c, + 0xac, 0x99, 0x20, 0xdc, 0x6a, 0x2b, 0x86, 0xfb, 0x75, 0x86, 0xef, 0x59, 0x29, 0x7c, 0x03, 0x44, + 0x4f, 0xe1, 0x44, 0x52, 0x70, 0xeb, 0x96, 0xca, 0xb0, 0x0e, 0xd6, 0xc4, 0x34, 0x2f, 0xb2, 0x14, + 0x18, 0x7d, 0x0d, 0xbd, 0x0d, 0xc4, 0xe7, 0x3f, 0x51, 0x11, 0x5e, 0x10, 0x6e, 0x9d, 0x1e, 0xd6, + 0x3c, 0x53, 0x2b, 0x4f, 0xa1, 0x8a, 0x96, 0x05, 0x95, 0x33, 0xc2, 0x9d, 0x9f, 0xa1, 0x53, 0xfd, + 0x4a, 0xe8, 0x11, 0x9c, 0xaa, 0x16, 0x72, 0xb2, 0x54, 0x96, 0x30, 0xdd, 0x5b, 0x72, 0xef, 0x91, + 0x25, 0x7a, 0x09, 0x3d, 0x4e, 0x96, 0xbe, 0x60, 0x7e, 0xb0, 0x60, 0xe1, 0x9b, 0x74, 0x95, 0x58, + 0xcd, 0x23, 0x75, 0x65, 0xdc, 0x23, 0xcb, 0xf3, 0x74, 0xce, 0x8a, 0x5e, 0x71, 0xb2, 0xfc, 0x8e, + 0xcd, 0x74, 0xe2, 0x17, 0xe6, 0x2f, 0x7f, 0x0c, 0x1a, 0xce, 0x33, 0xe8, 0x54, 0xa1, 0xe8, 0x1e, + 0xb4, 0xb6, 0x75, 0xe5, 0x12, 0xf5, 0xe1, 0xb4, 0x52, 0x4c, 0x1e, 0x97, 0x7b, 0xe7, 0x4f, 0x13, + 0xba, 0xbb, 0xb6, 0x40, 0x0c, 0x3e, 0x88, 0x73, 0x82, 0x05, 0xe1, 0xc2, 0x0f, 0x59, 0xca, 0x49, + 0xb8, 0x12, 0x74, 0x4d, 0xe4, 0x6d, 0xfc, 0xe0, 0xd2, 0x67, 0x19, 0xc9, 0xb1, 0x60, 0xb9, 0x65, + 0x28, 0xdd, 0x83, 0xba, 0xee, 0x6f, 0x75, 0x5c, 0xeb, 0x71, 0x87, 0x05, 0xd9, 0xd9, 0x96, 0xcb, + 0x23, 0xcb, 0xd9, 0x65, 0x01, 0x44, 0x3f, 0x80, 0x55, 0x16, 0xac, 0x17, 0x69, 0xfe, 0xb7, 0x22, + 0x0f, 0x0a, 0x82, 0x5d, 0xe6, 0xcf, 0x2a, 0xcc, 0xb5, 0xab, 0xa8, 0x7f, 0xc4, 0x74, 0x1f, 0x1e, + 0x56, 0x87, 0x3e, 0x04, 0x94, 0xe9, 0xbf, 0x33, 0x5c, 0x60, 0x9a, 0xc8, 0x14, 0x6e, 0x99, 0xc3, + 0xd6, 0xc8, 0x74, 0xef, 0xe9, 0xc8, 0x99, 0x0c, 0x78, 0x64, 0xc9, 0xd1, 0x33, 0xb8, 0x13, 0xb2, + 0x24, 0xa1, 0x22, 0x21, 0xa9, 0x28, 0xbc, 0xdb, 0xaf, 0x8b, 0x3e, 0x2b, 0x21, 0x6e, 0x15, 0x8e, + 0x3e, 0x07, 0xc8, 0x72, 0xb6, 0xa6, 0x9c, 0xb2, 0xb4, 0xb0, 0xf1, 0xa3, 0xbd, 0x19, 0x52, 0x20, + 0xdc, 0x0a, 0x18, 0x61, 0x78, 0x2f, 0x64, 0xe9, 0x9c, 0xe6, 0x09, 0x89, 0x7c, 0x6d, 0xac, 0x2d, + 0xb5, 0xb6, 0xb4, 0xb3, 0x2f, 0x44, 0xa7, 0x6c, 0x49, 0xad, 0x92, 0xc6, 0x93, 0x1e, 0xdb, 0x4a, + 0xd5, 0x2e, 0xfb, 0x12, 0x7a, 0xb5, 0x9e, 0x4b, 0x5b, 0x55, 0xbc, 0x60, 0x8c, 0x6e, 0xbb, 0xe5, + 0xbe, 0x30, 0x61, 0xb3, 0x34, 0xa1, 0xf3, 0x1a, 0x60, 0x4b, 0xfa, 0xff, 0x72, 0x91, 0x0d, 0x50, + 0xb9, 0x54, 0x4b, 0xe1, 0x2b, 0x27, 0xce, 0xef, 0x06, 0xdc, 0x2e, 0xaf, 0x52, 0x43, 0x1b, 0x75, + 0x34, 0x9a, 0x82, 0x19, 0x61, 0x81, 0xf5, 0xbc, 0x7d, 0xff, 0x68, 0xa3, 0xbf, 0xc2, 0x02, 0xbb, + 0x0a, 0x8a, 0x3e, 0x85, 0xb6, 0x1c, 0xac, 0x2b, 0xae, 0x27, 0xeb, 0xe0, 0x68, 0x92, 0xa7, 0x60, + 0xae, 0x86, 0x3b, 0xcf, 0x01, 0xed, 0x37, 0xfb, 0xc0, 0x2f, 0xba, 0xab, 0xb9, 0xb9, 0x77, 0xc3, + 0x1f, 0xa1, 0x53, 0x9d, 0x43, 0xb2, 0x7f, 0xf1, 0x0a, 0xe7, 0x11, 0xc5, 0x69, 0xd1, 0xbf, 0x62, + 0x2f, 0x9f, 0x23, 0x2d, 0x56, 0xf2, 0x74, 0x8f, 0x4e, 0xb4, 0x1d, 0xa5, 0xb3, 0x97, 0xef, 0xae, + 0x6d, 0xe3, 0xea, 0xda, 0x36, 0xfe, 0xb9, 0xb6, 0x8d, 0xdf, 0x6e, 0xec, 0xc6, 0xd5, 0x8d, 0xdd, + 0xf8, 0xeb, 0xc6, 0x6e, 0xbc, 0x7e, 0x12, 0x53, 0x71, 0xb1, 0x0a, 0xc6, 0x21, 0x4b, 0x26, 0xcf, + 0x69, 0xca, 0xc3, 0x0b, 0x8a, 0x27, 0x73, 0xbd, 0xf8, 0x88, 0x47, 0x6f, 0x26, 0x6f, 0xcb, 0xc7, + 0x52, 0x5c, 0x66, 0x84, 0x07, 0x6d, 0xf5, 0x50, 0x7e, 0xf2, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, + 0xd3, 0xf5, 0xbb, 0x75, 0x8c, 0x07, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -540,6 +648,67 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.BridgeSwitches) > 0 { + for iNdEx := len(m.BridgeSwitches) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.BridgeSwitches[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.Roles) > 0 { + for iNdEx := len(m.Roles) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Roles[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.Votes) > 0 { + for iNdEx := len(m.Votes) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Votes[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.RoleProposals) > 0 { + for iNdEx := len(m.RoleProposals) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.RoleProposals[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } + } + if m.NextRoleProposalId != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.NextRoleProposalId)) + i-- + dAtA[i] = 0x20 + } { size, err := m.ReceivingState.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -930,6 +1099,41 @@ func (m *ConfirmedProvision) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *BridgeSwitch) 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 *BridgeSwitch) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BridgeSwitch) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Status != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.Status)) + i-- + dAtA[i] = 0x10 + } + if len(m.Guardian) > 0 { + i -= len(m.Guardian) + copy(dAtA[i:], m.Guardian) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.Guardian))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { offset -= sovGenesis(v) base := offset @@ -953,6 +1157,33 @@ func (m *GenesisState) Size() (n int) { n += 1 + l + sovGenesis(uint64(l)) l = m.ReceivingState.Size() n += 1 + l + sovGenesis(uint64(l)) + if m.NextRoleProposalId != 0 { + n += 1 + sovGenesis(uint64(m.NextRoleProposalId)) + } + if len(m.RoleProposals) > 0 { + for _, e := range m.RoleProposals { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.Votes) > 0 { + for _, e := range m.Votes { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.Roles) > 0 { + for _, e := range m.Roles { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.BridgeSwitches) > 0 { + for _, e := range m.BridgeSwitches { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } return n } @@ -1111,6 +1342,22 @@ func (m *ConfirmedProvision) Size() (n int) { return n } +func (m *BridgeSwitch) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Guardian) + if l > 0 { + n += 1 + l + sovGenesis(uint64(l)) + } + if m.Status != 0 { + n += 1 + sovGenesis(uint64(m.Status)) + } + return n +} + func sovGenesis(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1245,6 +1492,161 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NextRoleProposalId", wireType) + } + m.NextRoleProposalId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.NextRoleProposalId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RoleProposals", 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.RoleProposals = append(m.RoleProposals, RoleProposal{}) + if err := m.RoleProposals[len(m.RoleProposals)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Votes", 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.Votes = append(m.Votes, Vote{}) + if err := m.Votes[len(m.Votes)-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 Roles", 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.Roles = append(m.Roles, RolePair{}) + if err := m.Roles[len(m.Roles)-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 BridgeSwitches", 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.BridgeSwitches = append(m.BridgeSwitches, BridgeSwitch{}) + if err := m.BridgeSwitches[len(m.BridgeSwitches)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenesis(dAtA[iNdEx:]) @@ -2261,6 +2663,107 @@ func (m *ConfirmedProvision) Unmarshal(dAtA []byte) error { } return nil } +func (m *BridgeSwitch) 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: BridgeSwitch: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BridgeSwitch: 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 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.Guardian = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + m.Status = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Status |= BridgeStatus(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 skipGenesis(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/fbridge/types/keys.go b/x/fbridge/types/keys.go index 714c3b4fcf..81653c6456 100644 --- a/x/fbridge/types/keys.go +++ b/x/fbridge/types/keys.go @@ -1,19 +1,52 @@ package types -import "encoding/binary" +import ( + "encoding/binary" + + sdk "github.com/Finschia/finschia-sdk/types" + "github.com/Finschia/finschia-sdk/types/address" + "github.com/Finschia/finschia-sdk/types/kv" +) const ( // ModuleName is the module name constant used in many places ModuleName = "fbridge" - // StoreKey is the store key string for distribution + // StoreKey is the store key string for fbridge StoreKey = ModuleName + + // MemStoreKey is the in-memory store key string for fbridge + MemStoreKey = "mem_" + StoreKey ) +// - 0x01: params +// - 0x02: next sequence number for bridge sending +// - 0x03: block number of sequence +// +// - 0x10: next proposal ID +// 0x11: proposal +// 0x12: vote +// - 0x13: role +// - 0x14: bridge switch +// +// - 0xF0: memstore initialized +// - 0xF1: role metadata +// - 0xF2: bridge status + 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 + + KeyNextProposalID = []byte{0x10} // key for the next role proposal ID + KeyProposalPrefix = []byte{0x11} // key prefix for the role proposal + KeyProposalVotePrefix = []byte{0x12} // key prefix for the role proposal vote + KeyRolePrefix = []byte{0x13} // key prefix for the role of an address + KeyBridgeSwitchPrefix = []byte{0x14} // key for the switch to halt + + KeyMemInitialized = []byte{0xF0} + KeyMemRoleMetadata = []byte{0xF1} // key for the role metadata + KeyMemBridgeInactiveCounter = []byte{0xF2} // key for the bridge inactive status ) func SeqToBlocknumKey(seq uint64) []byte { @@ -21,3 +54,54 @@ func SeqToBlocknumKey(seq uint64) []byte { binary.BigEndian.PutUint64(bz, seq) return append(KeySeqToBlocknumPrefix, bz...) } + +// GetProposalIDBytes returns the byte representation of the proposalID +func GetProposalIDBytes(proposalID uint64) []byte { + bz := make([]byte, 8) + binary.BigEndian.PutUint64(bz, proposalID) + return bz +} + +// ProposalKey key of a specific role proposal +func ProposalKey(proposalID uint64) []byte { + return append(KeyProposalPrefix, GetProposalIDBytes(proposalID)...) +} + +// VotesKey gets the first part of the votes key based on the proposalID +func VotesKey(proposalID uint64) []byte { + return append(KeyProposalVotePrefix, GetProposalIDBytes(proposalID)...) +} + +// VoterVoteKey key of a specific vote from the store +func VoterVoteKey(proposalID uint64, voterAddr sdk.AccAddress) []byte { + return append(VotesKey(proposalID), address.MustLengthPrefix(voterAddr.Bytes())...) +} + +// SplitVoterVoteKey split the voter key and returns the proposal id and voter address +func SplitVoterVoteKey(key []byte) (uint64, sdk.AccAddress) { + kv.AssertKeyAtLeastLength(key, 11) + proposalID := binary.BigEndian.Uint64(key[1:9]) + voter := sdk.AccAddress(key[10:]) + return proposalID, voter +} + +// RoleKey key of a specific role of the address from the store +func RoleKey(target sdk.AccAddress) []byte { + return append(KeyRolePrefix, address.MustLengthPrefix(target.Bytes())...) +} + +// SplitRoleKey split the role key and returns the address +func SplitRoleKey(key []byte) sdk.AccAddress { + kv.AssertKeyAtLeastLength(key, 3) + return key[2:] +} + +func BridgeSwitchKey(guardian sdk.AccAddress) []byte { + return append(KeyBridgeSwitchPrefix, address.MustLengthPrefix(guardian.Bytes())...) +} + +// SplitBridgeSwitchKey split the bridge switch key and returns the guardian address +func SplitBridgeSwitchKey(key []byte) sdk.AccAddress { + kv.AssertKeyAtLeastLength(key, 3) + return key[2:] +} diff --git a/x/fbridge/types/msgs.go b/x/fbridge/types/msgs.go index fce2320548..979176c073 100644 --- a/x/fbridge/types/msgs.go +++ b/x/fbridge/types/msgs.go @@ -12,8 +12,7 @@ var ( _ sdk.Msg = &MsgClaim{} _ sdk.Msg = &MsgSuggestRole{} _ sdk.Msg = &MsgAddVoteForRole{} - _ sdk.Msg = &MsgHalt{} - _ sdk.Msg = &MsgResume{} + _ sdk.Msg = &MsgSetBridgeStatus{} ) func (m MsgTransfer) ValidateBasic() error { return nil } @@ -106,22 +105,12 @@ func (m MsgAddVoteForRole) GetSignBytes() []byte { return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) } -func (m MsgHalt) ValidateBasic() error { return nil } +func (m MsgSetBridgeStatus) ValidateBasic() error { return nil } -func (m MsgHalt) GetSigners() []sdk.AccAddress { +func (m MsgSetBridgeStatus) 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 { +func (m MsgSetBridgeStatus) GetSignBytes() []byte { return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) } diff --git a/x/fbridge/types/params.go b/x/fbridge/types/params.go index ab1254f4c2..3ef148d1e8 100644 --- a/x/fbridge/types/params.go +++ b/x/fbridge/types/params.go @@ -1 +1,65 @@ package types + +import ( + "time" + + sdkerrors "github.com/Finschia/finschia-sdk/types/errors" +) + +func DefaultParams() Params { + return Params{ + GuardianTrustLevel: Fraction{Numerator: 2, Denominator: 3}, + OperatorTrustLevel: Fraction{Numerator: 2, Denominator: 3}, + JudgeTrustLevel: Fraction{Numerator: 1, Denominator: 1}, + ProposalPeriod: uint64(time.Minute * 60), + TimelockPeriod: uint64(time.Hour * 24), + } +} + +func ValidateParams(params Params) error { + if err := ValidateTrustLevel(params.GuardianTrustLevel); err != nil { + return sdkerrors.ErrInvalidRequest.Wrap("guardian trust level: " + err.Error()) + } + + if err := ValidateTrustLevel(params.OperatorTrustLevel); err != nil { + return sdkerrors.ErrInvalidRequest.Wrap("operator trust level: " + err.Error()) + } + + if err := ValidateTrustLevel(params.JudgeTrustLevel); err != nil { + return sdkerrors.ErrInvalidRequest.Wrap("judge trust level: " + err.Error()) + } + + if params.ProposalPeriod == 0 { + return sdkerrors.ErrInvalidRequest.Wrap("proposal period cannot be 0") + } + + if params.TimelockPeriod == 0 { + return sdkerrors.ErrInvalidRequest.Wrap("timelock period cannot be 0") + } + + return nil +} + +func CheckTrustLevelThreshold(total, current uint64, trustLevel Fraction) bool { + if err := ValidateTrustLevel(trustLevel); err != nil { + panic(err) + } + + if total*trustLevel.Numerator <= current*trustLevel.Denominator && + total > 0 && + current <= total { + return true + } + + return false +} + +func ValidateTrustLevel(trustLevel Fraction) error { + if trustLevel.Denominator < 1 || trustLevel.Numerator < 1 { + return sdkerrors.ErrInvalidRequest.Wrap("trust level must be positive") + } else if trustLevel.Denominator < trustLevel.Numerator { + return sdkerrors.ErrInvalidRequest.Wrap("trust level denominator must be greater than or equal to the numerator") + } + + return nil +} diff --git a/x/fbridge/types/params_test.go b/x/fbridge/types/params_test.go new file mode 100644 index 0000000000..025ee7bbd0 --- /dev/null +++ b/x/fbridge/types/params_test.go @@ -0,0 +1,62 @@ +package types_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + + "github.com/Finschia/finschia-sdk/x/fbridge/types" +) + +func TestCheckTrustLevelThreshold(t *testing.T) { + tcs := map[string]struct { + total uint64 + current uint64 + trustLevel types.Fraction + isPanic bool + isValid bool + }{ + "meet the trust level": { + current: 3, + total: 4, + trustLevel: types.Fraction{Numerator: 2, Denominator: 3}, + isValid: true, + }, + "not meet the trust level": { + current: 1, + total: 2, + trustLevel: types.Fraction{Numerator: 2, Denominator: 3}, + isValid: false, + }, + "total is 0": { + total: 0, + current: 3, + trustLevel: types.Fraction{Numerator: 2, Denominator: 3}, + isValid: false, + }, + "invalid trust level - 1": { + total: 10, + current: 8, + trustLevel: types.Fraction{Numerator: 3, Denominator: 2}, + isPanic: true, + }, + "invalid trust level - 2": { + total: 10, + current: 8, + trustLevel: types.Fraction{Numerator: 3, Denominator: 0}, + isPanic: true, + }, + } + + for name, tc := range tcs { + t.Run(name, func(t *testing.T) { + if tc.isPanic { + require.Panics(t, func() { types.CheckTrustLevelThreshold(tc.total, tc.current, tc.trustLevel) }) + } else if tc.isValid { + require.True(t, types.CheckTrustLevelThreshold(tc.total, tc.current, tc.trustLevel)) + } else { + require.False(t, types.CheckTrustLevelThreshold(tc.total, tc.current, tc.trustLevel)) + } + }) + } +} diff --git a/x/fbridge/types/query.pb.go b/x/fbridge/types/query.pb.go index 7583ca187f..e0aa3d380a 100644 --- a/x/fbridge/types/query.pb.go +++ b/x/fbridge/types/query.pb.go @@ -846,21 +846,23 @@ func (m *QueryCommitmentsResponse) GetCommitments() []string { return nil } -type QueryGuardiansRequest struct { +type QueryMembersRequest struct { + // the role name (guardian, operator, judge) + Role string `protobuf:"bytes,1,opt,name=role,proto3" json:"role,omitempty"` } -func (m *QueryGuardiansRequest) Reset() { *m = QueryGuardiansRequest{} } -func (m *QueryGuardiansRequest) String() string { return proto.CompactTextString(m) } -func (*QueryGuardiansRequest) ProtoMessage() {} -func (*QueryGuardiansRequest) Descriptor() ([]byte, []int) { +func (m *QueryMembersRequest) Reset() { *m = QueryMembersRequest{} } +func (m *QueryMembersRequest) String() string { return proto.CompactTextString(m) } +func (*QueryMembersRequest) ProtoMessage() {} +func (*QueryMembersRequest) Descriptor() ([]byte, []int) { return fileDescriptor_5e7780f9db9d346e, []int{18} } -func (m *QueryGuardiansRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryMembersRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryGuardiansRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryMembersRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryGuardiansRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryMembersRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -870,34 +872,41 @@ func (m *QueryGuardiansRequest) XXX_Marshal(b []byte, deterministic bool) ([]byt return b[:n], nil } } -func (m *QueryGuardiansRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryGuardiansRequest.Merge(m, src) +func (m *QueryMembersRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryMembersRequest.Merge(m, src) } -func (m *QueryGuardiansRequest) XXX_Size() int { +func (m *QueryMembersRequest) XXX_Size() int { return m.Size() } -func (m *QueryGuardiansRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryGuardiansRequest.DiscardUnknown(m) +func (m *QueryMembersRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryMembersRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryGuardiansRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryMembersRequest proto.InternalMessageInfo -type QueryGuardiansResponse struct { - Guardians []string `protobuf:"bytes,1,rep,name=guardians,proto3" json:"guardians,omitempty"` +func (m *QueryMembersRequest) GetRole() string { + if m != nil { + return m.Role + } + return "" +} + +type QueryMembersResponse struct { + Members []string `protobuf:"bytes,1,rep,name=members,proto3" json:"members,omitempty"` } -func (m *QueryGuardiansResponse) Reset() { *m = QueryGuardiansResponse{} } -func (m *QueryGuardiansResponse) String() string { return proto.CompactTextString(m) } -func (*QueryGuardiansResponse) ProtoMessage() {} -func (*QueryGuardiansResponse) Descriptor() ([]byte, []int) { +func (m *QueryMembersResponse) Reset() { *m = QueryMembersResponse{} } +func (m *QueryMembersResponse) String() string { return proto.CompactTextString(m) } +func (*QueryMembersResponse) ProtoMessage() {} +func (*QueryMembersResponse) Descriptor() ([]byte, []int) { return fileDescriptor_5e7780f9db9d346e, []int{19} } -func (m *QueryGuardiansResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryMembersResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryGuardiansResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryMembersResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryGuardiansResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryMembersResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -907,77 +916,41 @@ func (m *QueryGuardiansResponse) XXX_Marshal(b []byte, deterministic bool) ([]by return b[:n], nil } } -func (m *QueryGuardiansResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryGuardiansResponse.Merge(m, src) +func (m *QueryMembersResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryMembersResponse.Merge(m, src) } -func (m *QueryGuardiansResponse) XXX_Size() int { +func (m *QueryMembersResponse) XXX_Size() int { return m.Size() } -func (m *QueryGuardiansResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryGuardiansResponse.DiscardUnknown(m) +func (m *QueryMembersResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryMembersResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryGuardiansResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryMembersResponse proto.InternalMessageInfo -func (m *QueryGuardiansResponse) GetGuardians() []string { +func (m *QueryMembersResponse) GetMembers() []string { if m != nil { - return m.Guardians + return m.Members } return nil } -type QueryOperatorsRequest struct { +type QueryMemberRequest struct { + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` } -func (m *QueryOperatorsRequest) Reset() { *m = QueryOperatorsRequest{} } -func (m *QueryOperatorsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryOperatorsRequest) ProtoMessage() {} -func (*QueryOperatorsRequest) Descriptor() ([]byte, []int) { +func (m *QueryMemberRequest) Reset() { *m = QueryMemberRequest{} } +func (m *QueryMemberRequest) String() string { return proto.CompactTextString(m) } +func (*QueryMemberRequest) ProtoMessage() {} +func (*QueryMemberRequest) 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 { +func (m *QueryMemberRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryOperatorsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryMemberRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryOperatorsResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryMemberRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -987,77 +960,41 @@ func (m *QueryOperatorsResponse) XXX_Marshal(b []byte, deterministic bool) ([]by return b[:n], nil } } -func (m *QueryOperatorsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryOperatorsResponse.Merge(m, src) +func (m *QueryMemberRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryMemberRequest.Merge(m, src) } -func (m *QueryOperatorsResponse) XXX_Size() int { +func (m *QueryMemberRequest) XXX_Size() int { return m.Size() } -func (m *QueryOperatorsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryOperatorsResponse.DiscardUnknown(m) +func (m *QueryMemberRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryMemberRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryOperatorsResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryMemberRequest proto.InternalMessageInfo -func (m *QueryOperatorsResponse) GetOperators() []string { +func (m *QueryMemberRequest) GetAddress() 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 + return m.Address } -} -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) + return "" } -var xxx_messageInfo_QueryJudgesRequest proto.InternalMessageInfo - -type QueryJudgesResponse struct { - Judges []string `protobuf:"bytes,1,rep,name=judges,proto3" json:"judges,omitempty"` +type QueryMemberResponse struct { + Role string `protobuf:"bytes,1,opt,name=role,proto3" json:"role,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 *QueryMemberResponse) Reset() { *m = QueryMemberResponse{} } +func (m *QueryMemberResponse) String() string { return proto.CompactTextString(m) } +func (*QueryMemberResponse) ProtoMessage() {} +func (*QueryMemberResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_5e7780f9db9d346e, []int{21} } -func (m *QueryJudgesResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryMemberResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryJudgesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryMemberResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryJudgesResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryMemberResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -1067,23 +1004,23 @@ func (m *QueryJudgesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } -func (m *QueryJudgesResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryJudgesResponse.Merge(m, src) +func (m *QueryMemberResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryMemberResponse.Merge(m, src) } -func (m *QueryJudgesResponse) XXX_Size() int { +func (m *QueryMemberResponse) XXX_Size() int { return m.Size() } -func (m *QueryJudgesResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryJudgesResponse.DiscardUnknown(m) +func (m *QueryMemberResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryMemberResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryJudgesResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryMemberResponse proto.InternalMessageInfo -func (m *QueryJudgesResponse) GetJudges() []string { +func (m *QueryMemberResponse) GetRole() string { if m != nil { - return m.Judges + return m.Role } - return nil + return "" } type QueryProposalsRequest struct { @@ -1095,7 +1032,7 @@ 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} + return fileDescriptor_5e7780f9db9d346e, []int{22} } func (m *QueryProposalsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1132,14 +1069,16 @@ func (m *QueryProposalsRequest) GetPagination() *query.PageRequest { } type QueryProposalsResponse struct { - Proposals []*RoleProposal `protobuf:"bytes,1,rep,name=proposals,proto3" json:"proposals,omitempty"` + Proposals []RoleProposal `protobuf:"bytes,1,rep,name=proposals,proto3" json:"proposals"` + // pagination defines an pagination for the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,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} + return fileDescriptor_5e7780f9db9d346e, []int{23} } func (m *QueryProposalsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1168,23 +1107,30 @@ func (m *QueryProposalsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryProposalsResponse proto.InternalMessageInfo -func (m *QueryProposalsResponse) GetProposals() []*RoleProposal { +func (m *QueryProposalsResponse) GetProposals() []RoleProposal { if m != nil { return m.Proposals } return nil } +func (m *QueryProposalsResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + type QueryProposalRequest struct { // the proposal id - ProposalId string `protobuf:"bytes,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` + ProposalId uint64 `protobuf:"varint,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} + return fileDescriptor_5e7780f9db9d346e, []int{24} } func (m *QueryProposalRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1213,22 +1159,22 @@ func (m *QueryProposalRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryProposalRequest proto.InternalMessageInfo -func (m *QueryProposalRequest) GetProposalId() string { +func (m *QueryProposalRequest) GetProposalId() uint64 { if m != nil { return m.ProposalId } - return "" + return 0 } type QueryProposalResponse struct { - Proposal *RoleProposal `protobuf:"bytes,1,opt,name=proposal,proto3" json:"proposal,omitempty"` + Proposal RoleProposal `protobuf:"bytes,1,opt,name=proposal,proto3" json:"proposal"` } 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} + return fileDescriptor_5e7780f9db9d346e, []int{25} } func (m *QueryProposalResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1257,13 +1203,290 @@ func (m *QueryProposalResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryProposalResponse proto.InternalMessageInfo -func (m *QueryProposalResponse) GetProposal() *RoleProposal { +func (m *QueryProposalResponse) GetProposal() RoleProposal { if m != nil { return m.Proposal } + return RoleProposal{} +} + +type QueryVoteRequest struct { + // proposal_id defines the unique id of the proposal. + ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` + // voter defines the oter address for the proposals. + Voter string `protobuf:"bytes,2,opt,name=voter,proto3" json:"voter,omitempty"` +} + +func (m *QueryVoteRequest) Reset() { *m = QueryVoteRequest{} } +func (m *QueryVoteRequest) String() string { return proto.CompactTextString(m) } +func (*QueryVoteRequest) ProtoMessage() {} +func (*QueryVoteRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_5e7780f9db9d346e, []int{26} +} +func (m *QueryVoteRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryVoteRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryVoteRequest.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 *QueryVoteRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryVoteRequest.Merge(m, src) +} +func (m *QueryVoteRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryVoteRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryVoteRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryVoteRequest proto.InternalMessageInfo + +func (m *QueryVoteRequest) GetProposalId() uint64 { + if m != nil { + return m.ProposalId + } + return 0 +} + +func (m *QueryVoteRequest) GetVoter() string { + if m != nil { + return m.Voter + } + return "" +} + +type QueryVoteResponse struct { + // vote defined the queried vote. + Vote Vote `protobuf:"bytes,1,opt,name=vote,proto3" json:"vote"` +} + +func (m *QueryVoteResponse) Reset() { *m = QueryVoteResponse{} } +func (m *QueryVoteResponse) String() string { return proto.CompactTextString(m) } +func (*QueryVoteResponse) ProtoMessage() {} +func (*QueryVoteResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_5e7780f9db9d346e, []int{27} +} +func (m *QueryVoteResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryVoteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryVoteResponse.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 *QueryVoteResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryVoteResponse.Merge(m, src) +} +func (m *QueryVoteResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryVoteResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryVoteResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryVoteResponse proto.InternalMessageInfo + +func (m *QueryVoteResponse) GetVote() Vote { + if m != nil { + return m.Vote + } + return Vote{} +} + +type QueryVotesRequest struct { + // proposal_id defines the unique id of the proposal. + ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` +} + +func (m *QueryVotesRequest) Reset() { *m = QueryVotesRequest{} } +func (m *QueryVotesRequest) String() string { return proto.CompactTextString(m) } +func (*QueryVotesRequest) ProtoMessage() {} +func (*QueryVotesRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_5e7780f9db9d346e, []int{28} +} +func (m *QueryVotesRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryVotesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryVotesRequest.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 *QueryVotesRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryVotesRequest.Merge(m, src) +} +func (m *QueryVotesRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryVotesRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryVotesRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryVotesRequest proto.InternalMessageInfo + +func (m *QueryVotesRequest) GetProposalId() uint64 { + if m != nil { + return m.ProposalId + } + return 0 +} + +type QueryVotesResponse struct { + // votes defined the queried votes. + Votes []Vote `protobuf:"bytes,1,rep,name=votes,proto3" json:"votes"` +} + +func (m *QueryVotesResponse) Reset() { *m = QueryVotesResponse{} } +func (m *QueryVotesResponse) String() string { return proto.CompactTextString(m) } +func (*QueryVotesResponse) ProtoMessage() {} +func (*QueryVotesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_5e7780f9db9d346e, []int{29} +} +func (m *QueryVotesResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryVotesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryVotesResponse.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 *QueryVotesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryVotesResponse.Merge(m, src) +} +func (m *QueryVotesResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryVotesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryVotesResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryVotesResponse proto.InternalMessageInfo + +func (m *QueryVotesResponse) GetVotes() []Vote { + if m != nil { + return m.Votes + } return nil } +type QueryBridgeStatusRequest struct { +} + +func (m *QueryBridgeStatusRequest) Reset() { *m = QueryBridgeStatusRequest{} } +func (m *QueryBridgeStatusRequest) String() string { return proto.CompactTextString(m) } +func (*QueryBridgeStatusRequest) ProtoMessage() {} +func (*QueryBridgeStatusRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_5e7780f9db9d346e, []int{30} +} +func (m *QueryBridgeStatusRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryBridgeStatusRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryBridgeStatusRequest.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 *QueryBridgeStatusRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryBridgeStatusRequest.Merge(m, src) +} +func (m *QueryBridgeStatusRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryBridgeStatusRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryBridgeStatusRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryBridgeStatusRequest proto.InternalMessageInfo + +type QueryBridgeStatusResponse struct { + Status BridgeStatus `protobuf:"varint,1,opt,name=status,proto3,enum=lbm.fbridge.v1.BridgeStatus" json:"status,omitempty"` + Metadata BridgeStatusMetadata `protobuf:"bytes,2,opt,name=metadata,proto3" json:"metadata"` +} + +func (m *QueryBridgeStatusResponse) Reset() { *m = QueryBridgeStatusResponse{} } +func (m *QueryBridgeStatusResponse) String() string { return proto.CompactTextString(m) } +func (*QueryBridgeStatusResponse) ProtoMessage() {} +func (*QueryBridgeStatusResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_5e7780f9db9d346e, []int{31} +} +func (m *QueryBridgeStatusResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryBridgeStatusResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryBridgeStatusResponse.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 *QueryBridgeStatusResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryBridgeStatusResponse.Merge(m, src) +} +func (m *QueryBridgeStatusResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryBridgeStatusResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryBridgeStatusResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryBridgeStatusResponse proto.InternalMessageInfo + +func (m *QueryBridgeStatusResponse) GetStatus() BridgeStatus { + if m != nil { + return m.Status + } + return StatusEmpty +} + +func (m *QueryBridgeStatusResponse) GetMetadata() BridgeStatusMetadata { + if m != nil { + return m.Metadata + } + return BridgeStatusMetadata{} +} + func init() { proto.RegisterType((*QueryParamsRequest)(nil), "lbm.fbridge.v1.QueryParamsRequest") proto.RegisterType((*QueryParamsResponse)(nil), "lbm.fbridge.v1.QueryParamsResponse") @@ -1283,99 +1506,115 @@ func init() { 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((*QueryMembersRequest)(nil), "lbm.fbridge.v1.QueryMembersRequest") + proto.RegisterType((*QueryMembersResponse)(nil), "lbm.fbridge.v1.QueryMembersResponse") + proto.RegisterType((*QueryMemberRequest)(nil), "lbm.fbridge.v1.QueryMemberRequest") + proto.RegisterType((*QueryMemberResponse)(nil), "lbm.fbridge.v1.QueryMemberResponse") 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") + proto.RegisterType((*QueryVoteRequest)(nil), "lbm.fbridge.v1.QueryVoteRequest") + proto.RegisterType((*QueryVoteResponse)(nil), "lbm.fbridge.v1.QueryVoteResponse") + proto.RegisterType((*QueryVotesRequest)(nil), "lbm.fbridge.v1.QueryVotesRequest") + proto.RegisterType((*QueryVotesResponse)(nil), "lbm.fbridge.v1.QueryVotesResponse") + proto.RegisterType((*QueryBridgeStatusRequest)(nil), "lbm.fbridge.v1.QueryBridgeStatusRequest") + proto.RegisterType((*QueryBridgeStatusResponse)(nil), "lbm.fbridge.v1.QueryBridgeStatusResponse") } 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, + // 1422 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x58, 0xcf, 0x6f, 0x1b, 0x45, + 0x14, 0xce, 0xb6, 0x6e, 0x9a, 0x3c, 0xa3, 0xaa, 0x4c, 0xd3, 0x36, 0xd9, 0x06, 0x3b, 0xd9, 0xfe, + 0x48, 0xd3, 0x34, 0x3b, 0xb1, 0xdb, 0x12, 0x44, 0x7f, 0x50, 0x25, 0x90, 0xaa, 0xa0, 0x96, 0xe2, + 0x54, 0x20, 0x71, 0x89, 0xd6, 0xde, 0xa9, 0xbb, 0xaa, 0x77, 0xc7, 0xde, 0x59, 0x5b, 0xad, 0x42, + 0x2e, 0x20, 0x24, 0xe0, 0x84, 0x04, 0x1c, 0x7a, 0xe0, 0xc4, 0x85, 0xbf, 0x01, 0x89, 0x7b, 0xc5, + 0xa9, 0x12, 0x12, 0xe2, 0x84, 0x50, 0xc3, 0x1f, 0x82, 0x76, 0xf6, 0xcd, 0xda, 0x5e, 0xef, 0xda, + 0x0e, 0x17, 0x6e, 0xe3, 0xd9, 0xef, 0xbd, 0xef, 0x7b, 0x6f, 0x66, 0xdf, 0x7e, 0x32, 0xe8, 0x8d, + 0xaa, 0x4b, 0x1f, 0x55, 0x7d, 0xc7, 0xae, 0x33, 0xda, 0x29, 0xd1, 0x56, 0x9b, 0xf9, 0xcf, 0xcc, + 0xa6, 0xcf, 0x03, 0x4e, 0x8e, 0x35, 0xaa, 0xae, 0x89, 0xcf, 0xcc, 0x4e, 0x49, 0x9f, 0xaf, 0x73, + 0x5e, 0x6f, 0x30, 0x6a, 0x35, 0x1d, 0x6a, 0x79, 0x1e, 0x0f, 0xac, 0xc0, 0xe1, 0x9e, 0x88, 0xd0, + 0xfa, 0x4c, 0x9d, 0xd7, 0xb9, 0x5c, 0xd2, 0x70, 0x85, 0xbb, 0x97, 0x6a, 0x5c, 0xb8, 0x5c, 0xd0, + 0xaa, 0x25, 0x58, 0x94, 0x9c, 0x76, 0x4a, 0x55, 0x16, 0x58, 0x25, 0xda, 0xb4, 0xea, 0x8e, 0x27, + 0x53, 0x20, 0x76, 0x3e, 0xa1, 0x45, 0x51, 0xcb, 0xa7, 0xc6, 0x0c, 0x90, 0x8f, 0xc2, 0xf8, 0x07, + 0x96, 0x6f, 0xb9, 0xa2, 0xc2, 0x5a, 0x6d, 0x26, 0x02, 0xe3, 0x03, 0x38, 0xd1, 0xb7, 0x2b, 0x9a, + 0xdc, 0x13, 0x8c, 0x5c, 0x85, 0xc9, 0xa6, 0xdc, 0x99, 0xd5, 0x16, 0xb4, 0x8b, 0xf9, 0xf2, 0x29, + 0xb3, 0xbf, 0x16, 0x33, 0xc2, 0x6f, 0xe4, 0x5e, 0xfc, 0x55, 0x9c, 0xa8, 0x20, 0xd6, 0x98, 0x83, + 0xd3, 0x32, 0xd9, 0x7d, 0xf6, 0x34, 0xd8, 0x66, 0xad, 0x6d, 0xe6, 0xd9, 0x8a, 0xe7, 0x32, 0xcc, + 0x0e, 0x3e, 0x42, 0xb2, 0xe3, 0x70, 0x58, 0xb0, 0x96, 0x64, 0xca, 0x55, 0xc2, 0xa5, 0xb1, 0x06, + 0xba, 0x44, 0x6f, 0xb3, 0xd6, 0x43, 0xbe, 0xd1, 0xe0, 0xb5, 0x27, 0x5e, 0x3b, 0xd6, 0x4c, 0x08, + 0xe4, 0x04, 0x6b, 0x85, 0xd2, 0x0e, 0x5f, 0xcc, 0x55, 0xe4, 0xda, 0xb8, 0x0e, 0x67, 0x52, 0x23, + 0x90, 0x62, 0x1e, 0xa6, 0xab, 0x6a, 0x13, 0xe3, 0xba, 0x1b, 0xc6, 0x3b, 0xb0, 0x28, 0x83, 0xef, + 0xf8, 0xcc, 0x0a, 0x98, 0x08, 0x05, 0x6e, 0x3c, 0xfb, 0xb0, 0xc9, 0x7c, 0x2b, 0xe0, 0xbe, 0x62, + 0xd5, 0x61, 0x8a, 0xe3, 0x96, 0x94, 0x3a, 0x5d, 0x89, 0x7f, 0x1b, 0x6f, 0x82, 0x31, 0x2c, 0x41, + 0x66, 0x9d, 0xab, 0xb0, 0xd2, 0x17, 0xb7, 0x19, 0xe2, 0x6a, 0xed, 0xc0, 0xe9, 0xb0, 0x4d, 0xee, + 0x3d, 0x72, 0x7c, 0x97, 0xd9, 0xdb, 0xac, 0xa5, 0x9a, 0x78, 0x1b, 0x2e, 0x8f, 0x07, 0xcf, 0x24, + 0xbc, 0x0f, 0x85, 0xa8, 0x4d, 0xed, 0xaa, 0xeb, 0x04, 0x01, 0xb3, 0x1f, 0xf8, 0xbc, 0xe3, 0x08, + 0x87, 0x7b, 0x63, 0x94, 0xa9, 0xf2, 0x1d, 0xea, 0xe6, 0x7b, 0xae, 0x41, 0x31, 0x33, 0x21, 0xaa, + 0x58, 0x87, 0x9c, 0x6d, 0x05, 0x16, 0xde, 0xa4, 0x37, 0x06, 0x6e, 0x92, 0x0a, 0x78, 0xd7, 0x0a, + 0x2c, 0xbc, 0x50, 0x32, 0x80, 0xdc, 0x84, 0x49, 0x11, 0x58, 0x41, 0x5b, 0x48, 0xc6, 0x7c, 0xb9, + 0x98, 0x19, 0xba, 0x2d, 0x61, 0xea, 0x36, 0x46, 0x41, 0xc6, 0x43, 0x58, 0xc0, 0x2b, 0xc7, 0x6c, + 0x66, 0x4b, 0x81, 0x42, 0x82, 0x59, 0x4b, 0x8c, 0x53, 0xed, 0x0c, 0x1c, 0xf1, 0x2d, 0xaf, 0xce, + 0xb0, 0xde, 0xe8, 0x87, 0xb1, 0x8e, 0x77, 0x25, 0x3d, 0x2b, 0x96, 0x9c, 0x76, 0x43, 0xcb, 0xd8, + 0xfa, 0xf8, 0xa4, 0x06, 0x5a, 0x3f, 0x78, 0x5c, 0x71, 0x7b, 0xd3, 0x82, 0xfe, 0xe7, 0xf6, 0xae, + 0xe0, 0xcb, 0xbe, 0xc9, 0x5d, 0xd7, 0x09, 0x5c, 0xe6, 0x05, 0x22, 0xbb, 0x90, 0x1b, 0xf8, 0xfa, + 0xf7, 0x81, 0xb1, 0x80, 0x05, 0xc8, 0xd7, 0xba, 0xdb, 0xb2, 0x67, 0xd3, 0x95, 0xde, 0x2d, 0x63, + 0x19, 0x87, 0xd4, 0x3d, 0xe6, 0x56, 0x99, 0xdf, 0x3b, 0x07, 0x7c, 0xde, 0x60, 0x78, 0x70, 0x72, + 0x6d, 0xac, 0xc1, 0x4c, 0x3f, 0x14, 0x49, 0x66, 0xe1, 0xa8, 0x1b, 0x6d, 0x21, 0x81, 0xfa, 0x69, + 0x98, 0x38, 0x17, 0xa3, 0x08, 0x95, 0x7b, 0x16, 0x8e, 0x5a, 0xb6, 0xed, 0x33, 0x21, 0x30, 0xbd, + 0xfa, 0x99, 0x10, 0xd3, 0x7b, 0xe4, 0x03, 0x62, 0x76, 0xe0, 0x64, 0x34, 0x5c, 0x7d, 0xde, 0xe4, + 0xc2, 0x6a, 0xc4, 0xca, 0xb7, 0x00, 0xba, 0xd3, 0x1b, 0x4f, 0xee, 0x82, 0x19, 0x8d, 0x7a, 0x33, + 0x1c, 0xf5, 0x66, 0xf4, 0x1d, 0xc1, 0x51, 0x6f, 0x3e, 0xb0, 0xea, 0x0c, 0x63, 0x2b, 0x3d, 0x91, + 0xc6, 0x4f, 0x1a, 0x9c, 0x4a, 0x32, 0xa0, 0x9e, 0xdb, 0x30, 0xdd, 0x54, 0x9b, 0xb2, 0xe4, 0x7c, + 0x79, 0x3e, 0x79, 0xc0, 0x15, 0xde, 0x60, 0x2a, 0x12, 0x4f, 0xb7, 0x1b, 0x44, 0xee, 0xf4, 0x89, + 0x8c, 0xee, 0xc8, 0xd2, 0x48, 0x91, 0x11, 0x7d, 0x9f, 0xca, 0x75, 0x3c, 0x13, 0x45, 0xa5, 0xba, + 0x50, 0x84, 0xbc, 0x62, 0xdb, 0x71, 0x6c, 0xbc, 0x2e, 0xa0, 0xb6, 0xee, 0xda, 0xc6, 0x27, 0x89, + 0xfe, 0xc5, 0xc5, 0xdd, 0x82, 0x29, 0x05, 0xc3, 0xee, 0x8d, 0x53, 0x5b, 0x1c, 0x63, 0xdc, 0x85, + 0xe3, 0x32, 0xf1, 0xc7, 0x3c, 0x60, 0xe3, 0xaa, 0x09, 0xe7, 0x41, 0x87, 0x07, 0xcc, 0x97, 0xad, + 0x98, 0xae, 0x44, 0x3f, 0x8c, 0x4d, 0x78, 0xbd, 0x27, 0x15, 0xea, 0x33, 0x21, 0x17, 0x3e, 0x45, + 0x6d, 0x33, 0x49, 0x6d, 0x21, 0x56, 0xbd, 0x8a, 0x21, 0xce, 0xb8, 0xda, 0x93, 0x44, 0x8c, 0xdd, + 0x9e, 0x2d, 0xbc, 0xb9, 0x18, 0x85, 0xdc, 0x6b, 0x91, 0x4c, 0x75, 0xe8, 0xc3, 0xc8, 0x23, 0xa0, + 0xa1, 0xe3, 0xcb, 0xb9, 0x21, 0x31, 0xd1, 0xcb, 0xae, 0x3e, 0x39, 0xcf, 0x35, 0x98, 0x4b, 0x79, + 0xd8, 0xb5, 0x09, 0x38, 0x42, 0x42, 0x75, 0xc7, 0x06, 0x4f, 0xa1, 0x2f, 0x0a, 0xb1, 0x64, 0x0b, + 0xa6, 0x5c, 0x16, 0x58, 0x72, 0x6a, 0x45, 0xd7, 0xea, 0xdc, 0xb0, 0xb8, 0x7b, 0x88, 0x55, 0xa7, + 0xa8, 0x62, 0xcb, 0x3f, 0x9e, 0x80, 0x23, 0x52, 0x1b, 0x69, 0xc1, 0x64, 0x64, 0x48, 0x88, 0x91, + 0xcc, 0x34, 0xe8, 0x79, 0xf4, 0xb3, 0x43, 0x31, 0x51, 0x69, 0x46, 0xe1, 0xf3, 0xdf, 0xff, 0xf9, + 0xee, 0xd0, 0x2c, 0x39, 0x45, 0x13, 0xae, 0x2a, 0xf2, 0x3a, 0xe4, 0x6b, 0x0d, 0xf2, 0x3d, 0x66, + 0x86, 0x2c, 0xa5, 0x26, 0x1d, 0x74, 0x42, 0xfa, 0xc5, 0xd1, 0x40, 0x94, 0xb0, 0x24, 0x25, 0x2c, + 0x92, 0x62, 0x52, 0x82, 0x60, 0x9e, 0xed, 0x78, 0x75, 0xea, 0xb1, 0xa7, 0x81, 0x60, 0x2d, 0xf2, + 0xbd, 0x06, 0xc7, 0xfa, 0x8d, 0x0f, 0xb9, 0x94, 0xca, 0x92, 0xea, 0xa7, 0xf4, 0x95, 0xb1, 0xb0, + 0x28, 0x6a, 0x59, 0x8a, 0x3a, 0x4b, 0x16, 0xb3, 0x44, 0xc5, 0xb6, 0x8a, 0xfc, 0xa2, 0xc1, 0xc9, + 0x54, 0x47, 0x44, 0x4a, 0xa9, 0x8c, 0xc3, 0xec, 0x97, 0x5e, 0x3e, 0x48, 0x08, 0x6a, 0x7d, 0x5b, + 0x6a, 0xbd, 0x4a, 0xca, 0x49, 0xad, 0x3e, 0xab, 0x31, 0xa7, 0x13, 0xaa, 0x55, 0x5f, 0x7b, 0x41, + 0x77, 0xd5, 0x72, 0x8f, 0x86, 0x3d, 0xfd, 0x43, 0x83, 0xe2, 0x08, 0x9f, 0x45, 0xae, 0x0f, 0xd5, + 0x34, 0xdc, 0xcc, 0xe9, 0x37, 0xfe, 0x5b, 0x30, 0x96, 0xf6, 0x96, 0x2c, 0xad, 0x4c, 0xd6, 0xb2, + 0x4b, 0xab, 0x63, 0xaa, 0x9d, 0x9a, 0x4a, 0xb0, 0x13, 0x16, 0xf6, 0xab, 0x06, 0x64, 0xd0, 0xad, + 0x11, 0x33, 0xfd, 0x12, 0x64, 0xf9, 0x44, 0x9d, 0x8e, 0x8d, 0x47, 0xc5, 0x5b, 0x52, 0xf1, 0x6d, + 0x72, 0xeb, 0x80, 0x87, 0xd1, 0x54, 0x99, 0xe8, 0xae, 0x60, 0xad, 0x3d, 0xf2, 0xb3, 0x06, 0x64, + 0xd0, 0x0e, 0x65, 0xe8, 0xcf, 0x34, 0x5b, 0x19, 0xfa, 0xb3, 0x7d, 0x96, 0x51, 0x92, 0xfa, 0x57, + 0xc8, 0x72, 0xb6, 0xfe, 0xa4, 0xd4, 0xdf, 0x34, 0x98, 0x49, 0xf3, 0x89, 0x64, 0x2d, 0x63, 0x06, + 0x64, 0x1a, 0x55, 0xbd, 0x74, 0x80, 0x08, 0x14, 0x7c, 0x4f, 0x0a, 0xbe, 0x43, 0xde, 0x3b, 0x60, + 0xc3, 0x3d, 0x99, 0x74, 0x47, 0xc4, 0x59, 0xc3, 0x6b, 0x23, 0xc8, 0x0f, 0x1a, 0xe4, 0x7b, 0xec, + 0x5b, 0xc6, 0xc0, 0x1b, 0x74, 0x83, 0x19, 0x03, 0x2f, 0xc5, 0x09, 0x1a, 0x57, 0xa4, 0xe2, 0x55, + 0xb2, 0x92, 0xad, 0xb8, 0xc7, 0x16, 0x62, 0x93, 0xdb, 0x70, 0x14, 0xcd, 0x1e, 0x49, 0x1f, 0xec, + 0xfd, 0xae, 0x51, 0x3f, 0x37, 0x1c, 0x84, 0x52, 0x8a, 0x52, 0xca, 0x1c, 0x39, 0x9d, 0x94, 0x82, + 0xb6, 0x91, 0x7c, 0x06, 0x93, 0x51, 0x4c, 0xc6, 0x27, 0xa7, 0xcf, 0x4e, 0xea, 0x67, 0x87, 0x62, + 0x46, 0x8d, 0x56, 0xe4, 0xa4, 0xbb, 0xe8, 0x41, 0xf7, 0xc8, 0x1e, 0x4c, 0xc7, 0x96, 0x8f, 0x9c, + 0x4f, 0xff, 0x9e, 0x25, 0x4c, 0xa7, 0x7e, 0x61, 0x14, 0x0c, 0x65, 0x2c, 0x4a, 0x19, 0x67, 0xc8, + 0xdc, 0xc0, 0x97, 0x2f, 0x66, 0xfc, 0x4a, 0x83, 0x29, 0x15, 0x48, 0xce, 0x0d, 0xcd, 0xab, 0xd8, + 0xcf, 0x8f, 0x40, 0x21, 0x39, 0x95, 0xe4, 0xcb, 0x64, 0x29, 0x93, 0x9c, 0xee, 0xf6, 0xb8, 0xa2, + 0x3d, 0xf2, 0x8d, 0x06, 0xb9, 0xd0, 0xd2, 0x90, 0x85, 0x54, 0x82, 0x1e, 0x87, 0xa7, 0x2f, 0x0e, + 0x41, 0x20, 0xfd, 0x4d, 0x49, 0xbf, 0x4e, 0xae, 0x8d, 0x49, 0x4f, 0xa5, 0x83, 0xa2, 0xbb, 0xd2, + 0x0b, 0xee, 0x91, 0x2f, 0x35, 0x38, 0x22, 0xdd, 0x18, 0xc9, 0xe6, 0x8a, 0xcf, 0xc3, 0x18, 0x06, + 0x41, 0x3d, 0xd7, 0xa4, 0x1e, 0x4a, 0x56, 0x0f, 0xa4, 0x87, 0x7c, 0xa1, 0xc1, 0x6b, 0xbd, 0x16, + 0x8a, 0xa4, 0xbf, 0x83, 0x29, 0x86, 0x4f, 0x5f, 0x1e, 0x03, 0x39, 0xca, 0x22, 0x45, 0x3e, 0x6f, + 0xe3, 0xfd, 0x17, 0xaf, 0x0a, 0xda, 0xcb, 0x57, 0x05, 0xed, 0xef, 0x57, 0x05, 0xed, 0xdb, 0xfd, + 0xc2, 0xc4, 0xcb, 0xfd, 0xc2, 0xc4, 0x9f, 0xfb, 0x85, 0x89, 0x4f, 0xd7, 0xea, 0x4e, 0xf0, 0xb8, + 0x5d, 0x35, 0x6b, 0xdc, 0xa5, 0x5b, 0x8e, 0x27, 0x6a, 0x8f, 0x1d, 0x8b, 0x3e, 0xc2, 0xc5, 0xaa, + 0xb0, 0x9f, 0xd0, 0xa7, 0x71, 0xbe, 0xe0, 0x59, 0x93, 0x89, 0xea, 0xa4, 0xfc, 0x13, 0xeb, 0xca, + 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0xb3, 0xe6, 0xb2, 0x67, 0x70, 0x13, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1411,16 +1650,20 @@ type QueryClient interface { 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) + // Members queries the members of spcific group registered on the bridge + Members(ctx context.Context, in *QueryMembersRequest, opts ...grpc.CallOption) (*QueryMembersResponse, error) + // Member queries the role of a specific member + Member(ctx context.Context, in *QueryMemberRequest, opts ...grpc.CallOption) (*QueryMemberResponse, 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) + // Vote queries voted information based on proposalID, voterAddr. + Vote(ctx context.Context, in *QueryVoteRequest, opts ...grpc.CallOption) (*QueryVoteResponse, error) + // Votes queries votes of a given proposal. + Votes(ctx context.Context, in *QueryVotesRequest, opts ...grpc.CallOption) (*QueryVotesResponse, error) + // BridgeStatus queries the status of the bridge + BridgeStatus(ctx context.Context, in *QueryBridgeStatusRequest, opts ...grpc.CallOption) (*QueryBridgeStatusResponse, error) } type queryClient struct { @@ -1512,27 +1755,18 @@ func (c *queryClient) Commitments(ctx context.Context, in *QueryCommitmentsReque 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...) +func (c *queryClient) Members(ctx context.Context, in *QueryMembersRequest, opts ...grpc.CallOption) (*QueryMembersResponse, error) { + out := new(QueryMembersResponse) + err := c.cc.Invoke(ctx, "/lbm.fbridge.v1.Query/Members", 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...) +func (c *queryClient) Member(ctx context.Context, in *QueryMemberRequest, opts ...grpc.CallOption) (*QueryMemberResponse, error) { + out := new(QueryMemberResponse) + err := c.cc.Invoke(ctx, "/lbm.fbridge.v1.Query/Member", in, out, opts...) if err != nil { return nil, err } @@ -1557,39 +1791,70 @@ func (c *queryClient) Proposal(ctx context.Context, in *QueryProposalRequest, op 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 +func (c *queryClient) Vote(ctx context.Context, in *QueryVoteRequest, opts ...grpc.CallOption) (*QueryVoteResponse, error) { + out := new(QueryVoteResponse) + err := c.cc.Invoke(ctx, "/lbm.fbridge.v1.Query/Vote", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Votes(ctx context.Context, in *QueryVotesRequest, opts ...grpc.CallOption) (*QueryVotesResponse, error) { + out := new(QueryVotesResponse) + err := c.cc.Invoke(ctx, "/lbm.fbridge.v1.Query/Votes", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) BridgeStatus(ctx context.Context, in *QueryBridgeStatusRequest, opts ...grpc.CallOption) (*QueryBridgeStatusResponse, error) { + out := new(QueryBridgeStatusResponse) + err := c.cc.Invoke(ctx, "/lbm.fbridge.v1.Query/BridgeStatus", 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) + // Members queries the members of spcific group registered on the bridge + Members(context.Context, *QueryMembersRequest) (*QueryMembersResponse, error) + // Member queries the role of a specific member + Member(context.Context, *QueryMemberRequest) (*QueryMemberResponse, 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) + // Vote queries voted information based on proposalID, voterAddr. + Vote(context.Context, *QueryVoteRequest) (*QueryVoteResponse, error) + // Votes queries votes of a given proposal. + Votes(context.Context, *QueryVotesRequest) (*QueryVotesResponse, error) + // BridgeStatus queries the status of the bridge + BridgeStatus(context.Context, *QueryBridgeStatusRequest) (*QueryBridgeStatusResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -1623,14 +1888,11 @@ func (*UnimplementedQueryServer) NeededSubmissionSeqs(ctx context.Context, req * 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) Members(ctx context.Context, req *QueryMembersRequest) (*QueryMembersResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Members not implemented") } -func (*UnimplementedQueryServer) Judges(ctx context.Context, req *QueryJudgesRequest) (*QueryJudgesResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Judges not implemented") +func (*UnimplementedQueryServer) Member(ctx context.Context, req *QueryMemberRequest) (*QueryMemberResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Member not implemented") } func (*UnimplementedQueryServer) Proposals(ctx context.Context, req *QueryProposalsRequest) (*QueryProposalsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Proposals not implemented") @@ -1638,6 +1900,15 @@ func (*UnimplementedQueryServer) Proposals(ctx context.Context, req *QueryPropos func (*UnimplementedQueryServer) Proposal(ctx context.Context, req *QueryProposalRequest) (*QueryProposalResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Proposal not implemented") } +func (*UnimplementedQueryServer) Vote(ctx context.Context, req *QueryVoteRequest) (*QueryVoteResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Vote not implemented") +} +func (*UnimplementedQueryServer) Votes(ctx context.Context, req *QueryVotesRequest) (*QueryVotesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Votes not implemented") +} +func (*UnimplementedQueryServer) BridgeStatus(ctx context.Context, req *QueryBridgeStatusRequest) (*QueryBridgeStatusResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method BridgeStatus not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -1805,92 +2076,128 @@ func _Query_Commitments_Handler(srv interface{}, ctx context.Context, dec func(i 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) +func _Query_Members_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryMembersRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).Guardians(ctx, in) + return srv.(QueryServer).Members(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/lbm.fbridge.v1.Query/Guardians", + FullMethod: "/lbm.fbridge.v1.Query/Members", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Guardians(ctx, req.(*QueryGuardiansRequest)) + return srv.(QueryServer).Members(ctx, req.(*QueryMembersRequest)) } 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) +func _Query_Member_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryMemberRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).Operators(ctx, in) + return srv.(QueryServer).Member(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/lbm.fbridge.v1.Query/Operators", + FullMethod: "/lbm.fbridge.v1.Query/Member", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Operators(ctx, req.(*QueryOperatorsRequest)) + return srv.(QueryServer).Member(ctx, req.(*QueryMemberRequest)) } 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) +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).Judges(ctx, in) + return srv.(QueryServer).Proposals(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/lbm.fbridge.v1.Query/Judges", + FullMethod: "/lbm.fbridge.v1.Query/Proposals", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Judges(ctx, req.(*QueryJudgesRequest)) + return srv.(QueryServer).Proposals(ctx, req.(*QueryProposalsRequest)) } 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) +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).Proposals(ctx, in) + return srv.(QueryServer).Proposal(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/lbm.fbridge.v1.Query/Proposals", + FullMethod: "/lbm.fbridge.v1.Query/Proposal", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Proposals(ctx, req.(*QueryProposalsRequest)) + return srv.(QueryServer).Proposal(ctx, req.(*QueryProposalRequest)) } 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) +func _Query_Vote_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryVoteRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).Proposal(ctx, in) + return srv.(QueryServer).Vote(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/lbm.fbridge.v1.Query/Proposal", + FullMethod: "/lbm.fbridge.v1.Query/Vote", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Proposal(ctx, req.(*QueryProposalRequest)) + return srv.(QueryServer).Vote(ctx, req.(*QueryVoteRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Votes_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryVotesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Votes(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/lbm.fbridge.v1.Query/Votes", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Votes(ctx, req.(*QueryVotesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_BridgeStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryBridgeStatusRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).BridgeStatus(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/lbm.fbridge.v1.Query/BridgeStatus", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).BridgeStatus(ctx, req.(*QueryBridgeStatusRequest)) } return interceptor(ctx, in, info, handler) } @@ -1936,16 +2243,12 @@ var _Query_serviceDesc = grpc.ServiceDesc{ Handler: _Query_Commitments_Handler, }, { - MethodName: "Guardians", - Handler: _Query_Guardians_Handler, - }, - { - MethodName: "Operators", - Handler: _Query_Operators_Handler, + MethodName: "Members", + Handler: _Query_Members_Handler, }, { - MethodName: "Judges", - Handler: _Query_Judges_Handler, + MethodName: "Member", + Handler: _Query_Member_Handler, }, { MethodName: "Proposals", @@ -1955,6 +2258,18 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "Proposal", Handler: _Query_Proposal_Handler, }, + { + MethodName: "Vote", + Handler: _Query_Vote_Handler, + }, + { + MethodName: "Votes", + Handler: _Query_Votes_Handler, + }, + { + MethodName: "BridgeStatus", + Handler: _Query_BridgeStatus_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "lbm/fbridge/v1/query.proto", @@ -2543,7 +2858,7 @@ func (m *QueryCommitmentsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error return len(dAtA) - i, nil } -func (m *QueryGuardiansRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryMembersRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2553,20 +2868,27 @@ func (m *QueryGuardiansRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryGuardiansRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryMembersRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryGuardiansRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryMembersRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l + if len(m.Role) > 0 { + i -= len(m.Role) + copy(dAtA[i:], m.Role) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Role))) + i-- + dAtA[i] = 0xa + } return len(dAtA) - i, nil } -func (m *QueryGuardiansResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryMembersResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2576,21 +2898,21 @@ func (m *QueryGuardiansResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryGuardiansResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryMembersResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryGuardiansResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryMembersResponse) 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]))) + if len(m.Members) > 0 { + for iNdEx := len(m.Members) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Members[iNdEx]) + copy(dAtA[i:], m.Members[iNdEx]) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Members[iNdEx]))) i-- dAtA[i] = 0xa } @@ -2598,7 +2920,7 @@ func (m *QueryGuardiansResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } -func (m *QueryOperatorsRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryMemberRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2608,20 +2930,27 @@ func (m *QueryOperatorsRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryOperatorsRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryMemberRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryOperatorsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryMemberRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } return len(dAtA) - i, nil } -func (m *QueryOperatorsResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryMemberResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2631,29 +2960,27 @@ func (m *QueryOperatorsResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryOperatorsResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryMemberResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryOperatorsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryMemberResponse) 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 - } + if len(m.Role) > 0 { + i -= len(m.Role) + copy(dAtA[i:], m.Role) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Role))) + i-- + dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *QueryJudgesRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryProposalsRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2663,20 +2990,32 @@ func (m *QueryJudgesRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryJudgesRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryProposalsRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryJudgesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +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 *QueryJudgesResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryProposalsResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2686,21 +3025,38 @@ func (m *QueryJudgesResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryJudgesResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryProposalsResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryJudgesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryProposalsResponse) 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]))) + 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.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 } @@ -2708,7 +3064,7 @@ func (m *QueryJudgesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *QueryProposalsRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryProposalRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2718,32 +3074,25 @@ func (m *QueryProposalsRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryProposalsRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryProposalRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryProposalsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryProposalRequest) 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)) - } + if m.ProposalId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.ProposalId)) i-- - dAtA[i] = 0xa + dAtA[i] = 0x8 } return len(dAtA) - i, nil } -func (m *QueryProposalsResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryProposalResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2753,34 +3102,30 @@ func (m *QueryProposalsResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryProposalsResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryProposalResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryProposalsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryProposalResponse) 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 + { + 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 (m *QueryProposalRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryVoteRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2790,27 +3135,32 @@ func (m *QueryProposalRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryProposalRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryVoteRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryProposalRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryVoteRequest) 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))) + if len(m.Voter) > 0 { + i -= len(m.Voter) + copy(dAtA[i:], m.Voter) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Voter))) i-- - dAtA[i] = 0xa + dAtA[i] = 0x12 + } + if m.ProposalId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.ProposalId)) + i-- + dAtA[i] = 0x8 } return len(dAtA) - i, nil } -func (m *QueryProposalResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryVoteResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2820,72 +3170,196 @@ func (m *QueryProposalResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryProposalResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryVoteResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryProposalResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryVoteResponse) 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)) + { + size, err := m.Vote.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } - i-- - dAtA[i] = 0xa + 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 +func (m *QueryVotesRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - var l int - _ = l - return n + return dAtA[:n], nil } -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 *QueryVotesRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryNextSeqSendRequest) Size() (n int) { - if m == nil { - return 0 - } +func (m *QueryVotesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - return n + if m.ProposalId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.ProposalId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil } -func (m *QueryNextSeqSendResponse) Size() (n int) { +func (m *QueryVotesResponse) 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 *QueryVotesResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryVotesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Votes) > 0 { + for iNdEx := len(m.Votes) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Votes[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 *QueryBridgeStatusRequest) 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 *QueryBridgeStatusRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryBridgeStatusRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryBridgeStatusResponse) 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 *QueryBridgeStatusResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryBridgeStatusResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Metadata.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if m.Status != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Status)) + i-- + dAtA[i] = 0x8 + } + 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 } @@ -3088,23 +3562,27 @@ func (m *QueryCommitmentsResponse) Size() (n int) { return n } -func (m *QueryGuardiansRequest) Size() (n int) { +func (m *QueryMembersRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l + l = len(m.Role) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } return n } -func (m *QueryGuardiansResponse) Size() (n int) { +func (m *QueryMembersResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - if len(m.Guardians) > 0 { - for _, s := range m.Guardians { + if len(m.Members) > 0 { + for _, s := range m.Members { l = len(s) n += 1 + l + sovQuery(uint64(l)) } @@ -3112,75 +3590,134 @@ func (m *QueryGuardiansResponse) Size() (n int) { return n } -func (m *QueryOperatorsRequest) Size() (n int) { +func (m *QueryMemberRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } return n } -func (m *QueryOperatorsResponse) Size() (n int) { +func (m *QueryMemberResponse) 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)) - } + l = len(m.Role) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) } return n } -func (m *QueryJudgesRequest) Size() (n int) { +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 *QueryJudgesResponse) Size() (n int) { +func (m *QueryProposalsResponse) 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) + if len(m.Proposals) > 0 { + for _, e := range m.Proposals { + 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 (m *QueryProposalsRequest) Size() (n int) { +func (m *QueryProposalRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.Pagination != nil { - l = m.Pagination.Size() + if m.ProposalId != 0 { + n += 1 + sovQuery(uint64(m.ProposalId)) + } + return n +} + +func (m *QueryProposalResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Proposal.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryVoteRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ProposalId != 0 { + n += 1 + sovQuery(uint64(m.ProposalId)) + } + l = len(m.Voter) + if l > 0 { n += 1 + l + sovQuery(uint64(l)) } return n } -func (m *QueryProposalsResponse) Size() (n int) { +func (m *QueryVoteResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - if len(m.Proposals) > 0 { - for _, e := range m.Proposals { + l = m.Vote.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryVotesRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ProposalId != 0 { + n += 1 + sovQuery(uint64(m.ProposalId)) + } + return n +} + +func (m *QueryVotesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Votes) > 0 { + for _, e := range m.Votes { l = e.Size() n += 1 + l + sovQuery(uint64(l)) } @@ -3188,29 +3725,26 @@ func (m *QueryProposalsResponse) Size() (n int) { return n } -func (m *QueryProposalRequest) Size() (n int) { +func (m *QueryBridgeStatusRequest) 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) { +func (m *QueryBridgeStatusResponse) 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)) + if m.Status != 0 { + n += 1 + sovQuery(uint64(m.Status)) } + l = m.Metadata.Size() + n += 1 + l + sovQuery(uint64(l)) return n } @@ -4774,7 +5308,7 @@ func (m *QueryCommitmentsResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryGuardiansRequest) Unmarshal(dAtA []byte) error { +func (m *QueryMembersRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4784,25 +5318,389 @@ func (m *QueryGuardiansRequest) Unmarshal(dAtA []byte) error { if shift >= 64 { return ErrIntOverflowQuery } - if iNdEx >= l { + 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: QueryMembersRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryMembersRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Role", 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.Role = 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 *QueryMembersResponse) 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: QueryMembersResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryMembersResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Members", 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.Members = append(m.Members, 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 *QueryMemberRequest) 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: QueryMemberRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryMemberRequest: 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 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.Address = 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 *QueryMemberResponse) 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: QueryMemberResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryMemberResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Role", 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.Role = 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 } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} } - } - 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 { + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -4824,7 +5722,7 @@ func (m *QueryGuardiansRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryGuardiansResponse) Unmarshal(dAtA []byte) error { +func (m *QueryProposalsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4847,17 +5745,17 @@ func (m *QueryGuardiansResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryGuardiansResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryProposalsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGuardiansResponse: illegal tag %d (wire type %d)", fieldNum, wire) + 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 Guardians", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Proposals", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -4867,23 +5765,61 @@ func (m *QueryGuardiansResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + 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 + 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 } - m.Guardians = append(m.Guardians, string(dAtA[iNdEx:postIndex])) + 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 @@ -4906,7 +5842,7 @@ func (m *QueryGuardiansResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryOperatorsRequest) Unmarshal(dAtA []byte) error { +func (m *QueryProposalRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4929,12 +5865,31 @@ func (m *QueryOperatorsRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryOperatorsRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryProposalRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryOperatorsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryProposalRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + 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 ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProposalId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -4956,7 +5911,7 @@ func (m *QueryOperatorsRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryOperatorsResponse) Unmarshal(dAtA []byte) error { +func (m *QueryProposalResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4979,17 +5934,17 @@ func (m *QueryOperatorsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryOperatorsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryProposalResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryOperatorsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + 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 Operators", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Proposal", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -4999,23 +5954,24 @@ func (m *QueryOperatorsResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.Operators = append(m.Operators, string(dAtA[iNdEx:postIndex])) + if err := m.Proposal.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex @@ -5038,7 +5994,7 @@ func (m *QueryOperatorsResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryJudgesRequest) Unmarshal(dAtA []byte) error { +func (m *QueryVoteRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5061,12 +6017,63 @@ func (m *QueryJudgesRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryJudgesRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryVoteRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryJudgesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryVoteRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + 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 ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProposalId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Voter", 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.Voter = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -5088,7 +6095,7 @@ func (m *QueryJudgesRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryJudgesResponse) Unmarshal(dAtA []byte) error { +func (m *QueryVoteResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5111,17 +6118,17 @@ func (m *QueryJudgesResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryJudgesResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryVoteResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryJudgesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryVoteResponse: 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) + return fmt.Errorf("proto: wrong wireType = %d for field Vote", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -5131,23 +6138,24 @@ func (m *QueryJudgesResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.Judges = append(m.Judges, string(dAtA[iNdEx:postIndex])) + if err := m.Vote.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex @@ -5170,7 +6178,7 @@ func (m *QueryJudgesResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryProposalsRequest) Unmarshal(dAtA []byte) error { +func (m *QueryVotesRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5193,17 +6201,17 @@ func (m *QueryProposalsRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryProposalsRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryVotesRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryProposalsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryVotesRequest: 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) + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) } - var msglen int + m.ProposalId = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -5213,28 +6221,11 @@ func (m *QueryProposalsRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + m.ProposalId |= uint64(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:]) @@ -5256,7 +6247,7 @@ func (m *QueryProposalsRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryProposalsResponse) Unmarshal(dAtA []byte) error { +func (m *QueryVotesResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5279,15 +6270,15 @@ func (m *QueryProposalsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryProposalsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryVotesResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryProposalsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryVotesResponse: 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) + return fmt.Errorf("proto: wrong wireType = %d for field Votes", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -5314,8 +6305,8 @@ func (m *QueryProposalsResponse) Unmarshal(dAtA []byte) error { 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 { + m.Votes = append(m.Votes, Vote{}) + if err := m.Votes[len(m.Votes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -5340,7 +6331,7 @@ func (m *QueryProposalsResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryProposalRequest) Unmarshal(dAtA []byte) error { +func (m *QueryBridgeStatusRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5363,44 +6354,12 @@ func (m *QueryProposalRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryProposalRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryBridgeStatusRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryProposalRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryBridgeStatusRequest: 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:]) @@ -5422,7 +6381,7 @@ func (m *QueryProposalRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryProposalResponse) Unmarshal(dAtA []byte) error { +func (m *QueryBridgeStatusResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5445,15 +6404,34 @@ func (m *QueryProposalResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryProposalResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryBridgeStatusResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryProposalResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryBridgeStatusResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + m.Status = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Status |= BridgeStatus(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Proposal", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -5480,10 +6458,7 @@ func (m *QueryProposalResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Proposal == nil { - m.Proposal = &RoleProposal{} - } - if err := m.Proposal.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Metadata.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/fbridge/types/query.pb.gw.go b/x/fbridge/types/query.pb.gw.go index c62ab4e113..30afc929bb 100644 --- a/x/fbridge/types/query.pb.gw.go +++ b/x/fbridge/types/query.pb.gw.go @@ -431,56 +431,92 @@ func local_request_Query_Commitments_0(ctx context.Context, marshaler runtime.Ma } -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 ( + filter_Query_Members_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_Members_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryMembersRequest var metadata runtime.ServerMetadata - msg, err := client.Guardians(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Members_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.Members(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 +func local_request_Query_Members_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryMembersRequest var metadata runtime.ServerMetadata - msg, err := server.Guardians(ctx, &protoReq) + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Members_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.Members(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 +func request_Query_Member_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryMemberRequest var metadata runtime.ServerMetadata - msg, err := client.Operators(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err + var ( + val string + ok bool + err error + _ = err + ) -} + val, ok = pathParams["address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address") + } -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 + protoReq.Address, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) + } - msg, err := server.Operators(ctx, &protoReq) + msg, err := client.Member(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) 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 +func local_request_Query_Member_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryMemberRequest var metadata runtime.ServerMetadata - msg, err := client.Judges(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err + var ( + val string + ok bool + err error + _ = err + ) -} + val, ok = pathParams["address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address") + } -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 + protoReq.Address, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) + } - msg, err := server.Judges(ctx, &protoReq) + msg, err := server.Member(ctx, &protoReq) return msg, metadata, err } @@ -537,7 +573,7 @@ func request_Query_Proposal_0(ctx context.Context, marshaler runtime.Marshaler, return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "proposal_id") } - protoReq.ProposalId, err = runtime.String(val) + protoReq.ProposalId, err = runtime.Uint64(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "proposal_id", err) @@ -564,7 +600,7 @@ func local_request_Query_Proposal_0(ctx context.Context, marshaler runtime.Marsh return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "proposal_id") } - protoReq.ProposalId, err = runtime.String(val) + protoReq.ProposalId, err = runtime.Uint64(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "proposal_id", err) @@ -575,6 +611,154 @@ func local_request_Query_Proposal_0(ctx context.Context, marshaler runtime.Marsh } +func request_Query_Vote_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryVoteRequest + 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.Uint64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "proposal_id", err) + } + + val, ok = pathParams["voter"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "voter") + } + + protoReq.Voter, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "voter", err) + } + + msg, err := client.Vote(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Vote_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryVoteRequest + 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.Uint64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "proposal_id", err) + } + + val, ok = pathParams["voter"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "voter") + } + + protoReq.Voter, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "voter", err) + } + + msg, err := server.Vote(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_Votes_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryVotesRequest + 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.Uint64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "proposal_id", err) + } + + msg, err := client.Votes(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Votes_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryVotesRequest + 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.Uint64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "proposal_id", err) + } + + msg, err := server.Votes(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_BridgeStatus_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryBridgeStatusRequest + var metadata runtime.ServerMetadata + + msg, err := client.BridgeStatus(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_BridgeStatus_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryBridgeStatusRequest + var metadata runtime.ServerMetadata + + msg, err := server.BridgeStatus(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. @@ -761,7 +945,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) - mux.Handle("GET", pattern_Query_Guardians_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_Members_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) @@ -770,18 +954,18 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_Guardians_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_Members_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()...) + forward_Query_Members_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) { + mux.Handle("GET", pattern_Query_Member_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) @@ -790,18 +974,18 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_Operators_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_Member_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()...) + forward_Query_Member_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) { + 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) @@ -810,18 +994,18 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_Judges_0(rctx, inboundMarshaler, server, req, pathParams) + 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_Judges_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_Proposals_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) { + 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) @@ -830,18 +1014,18 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_Proposals_0(rctx, inboundMarshaler, server, req, pathParams) + 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_Proposals_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_Proposal_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) { + mux.Handle("GET", pattern_Query_Vote_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) @@ -850,14 +1034,54 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_Proposal_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_Vote_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()...) + forward_Query_Vote_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Votes_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_Votes_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_Votes_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_BridgeStatus_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_BridgeStatus_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_BridgeStatus_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -1082,7 +1306,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) - mux.Handle("GET", pattern_Query_Guardians_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_Members_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) @@ -1091,18 +1315,18 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_Guardians_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_Members_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()...) + forward_Query_Members_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) { + mux.Handle("GET", pattern_Query_Member_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) @@ -1111,18 +1335,18 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_Operators_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_Member_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()...) + forward_Query_Member_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) { + 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) @@ -1131,18 +1355,18 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_Judges_0(rctx, inboundMarshaler, client, req, pathParams) + 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_Judges_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_Proposals_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) { + 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) @@ -1151,18 +1375,18 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_Proposals_0(rctx, inboundMarshaler, client, req, pathParams) + 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_Proposals_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_Proposal_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) { + mux.Handle("GET", pattern_Query_Vote_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) @@ -1171,14 +1395,54 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_Proposal_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_Vote_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()...) + forward_Query_Vote_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Votes_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_Votes_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_Votes_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_BridgeStatus_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_BridgeStatus_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_BridgeStatus_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -1204,15 +1468,19 @@ var ( 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_Members_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"lbm", "fbridge", "v1", "members"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_Member_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"lbm", "fbridge", "v1", "members", "address"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_Proposals_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"lbm", "fbridge", "v1", "proposals"}, "", 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_Proposal_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"lbm", "fbridge", "v1", "proposals", "proposal_id"}, "", 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_Vote_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5, 1, 0, 4, 1, 5, 6}, []string{"lbm", "fbridge", "v1", "proposals", "proposal_id", "votes", "voter"}, "", 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_Votes_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"lbm", "fbridge", "v1", "proposals", "proposal_id", "votes"}, "", 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))) + pattern_Query_BridgeStatus_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"lbm", "fbridge", "v1", "status"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( @@ -1234,13 +1502,17 @@ var ( forward_Query_Commitments_0 = runtime.ForwardResponseMessage - forward_Query_Guardians_0 = runtime.ForwardResponseMessage + forward_Query_Members_0 = runtime.ForwardResponseMessage - forward_Query_Operators_0 = runtime.ForwardResponseMessage - - forward_Query_Judges_0 = runtime.ForwardResponseMessage + forward_Query_Member_0 = runtime.ForwardResponseMessage forward_Query_Proposals_0 = runtime.ForwardResponseMessage forward_Query_Proposal_0 = runtime.ForwardResponseMessage + + forward_Query_Vote_0 = runtime.ForwardResponseMessage + + forward_Query_Votes_0 = runtime.ForwardResponseMessage + + forward_Query_BridgeStatus_0 = runtime.ForwardResponseMessage ) diff --git a/x/fbridge/types/tx.pb.go b/x/fbridge/types/tx.pb.go index 91346052d5..150c4f9476 100644 --- a/x/fbridge/types/tx.pb.go +++ b/x/fbridge/types/tx.pb.go @@ -753,7 +753,7 @@ func (m *MsgSuggestRole) GetRole() Role { if m != nil { return m.Role } - return Role_UNSPECIFIED + return RoleEmpty } type MsgSuggestRoleResponse struct { @@ -798,9 +798,7 @@ type MsgAddVoteForRole struct { // 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"` + Option VoteOption `protobuf:"varint,3,opt,name=option,proto3,enum=lbm.fbridge.v1.VoteOption" json:"option,omitempty"` } func (m *MsgAddVoteForRole) Reset() { *m = MsgAddVoteForRole{} } @@ -850,11 +848,11 @@ func (m *MsgAddVoteForRole) GetProposalId() uint64 { return 0 } -func (m *MsgAddVoteForRole) GetOption() bool { +func (m *MsgAddVoteForRole) GetOption() VoteOption { if m != nil { return m.Option } - return false + return OptionEmpty } type MsgAddVoteForRoleResponse struct { @@ -893,24 +891,25 @@ func (m *MsgAddVoteForRoleResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgAddVoteForRoleResponse proto.InternalMessageInfo -// MsgHalt is input values required for halting the bridge module -type MsgHalt struct { +// MsgSetBridgeStatus is input values required for setting the status of the bridge module +type MsgSetBridgeStatus struct { // the guardian address - Guardian string `protobuf:"bytes,1,opt,name=guardian,proto3" json:"guardian,omitempty"` + Guardian string `protobuf:"bytes,1,opt,name=guardian,proto3" json:"guardian,omitempty"` + Status BridgeStatus `protobuf:"varint,2,opt,name=status,proto3,enum=lbm.fbridge.v1.BridgeStatus" json:"status,omitempty"` } -func (m *MsgHalt) Reset() { *m = MsgHalt{} } -func (m *MsgHalt) String() string { return proto.CompactTextString(m) } -func (*MsgHalt) ProtoMessage() {} -func (*MsgHalt) Descriptor() ([]byte, []int) { +func (m *MsgSetBridgeStatus) Reset() { *m = MsgSetBridgeStatus{} } +func (m *MsgSetBridgeStatus) String() string { return proto.CompactTextString(m) } +func (*MsgSetBridgeStatus) ProtoMessage() {} +func (*MsgSetBridgeStatus) Descriptor() ([]byte, []int) { return fileDescriptor_54a336bc5ea063bb, []int{18} } -func (m *MsgHalt) XXX_Unmarshal(b []byte) error { +func (m *MsgSetBridgeStatus) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgHalt) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgSetBridgeStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgHalt.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgSetBridgeStatus.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -920,122 +919,47 @@ func (m *MsgHalt) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } -func (m *MsgHalt) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgHalt.Merge(m, src) +func (m *MsgSetBridgeStatus) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSetBridgeStatus.Merge(m, src) } -func (m *MsgHalt) XXX_Size() int { +func (m *MsgSetBridgeStatus) XXX_Size() int { return m.Size() } -func (m *MsgHalt) XXX_DiscardUnknown() { - xxx_messageInfo_MsgHalt.DiscardUnknown(m) +func (m *MsgSetBridgeStatus) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSetBridgeStatus.DiscardUnknown(m) } -var xxx_messageInfo_MsgHalt proto.InternalMessageInfo +var xxx_messageInfo_MsgSetBridgeStatus proto.InternalMessageInfo -func (m *MsgHalt) GetGuardian() string { +func (m *MsgSetBridgeStatus) 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 { +func (m *MsgSetBridgeStatus) GetStatus() BridgeStatus { if m != nil { - return m.From + return m.Status } - return "" + return StatusEmpty } -type MsgResumeResponse struct { +type MsgSetBridgeStatusResponse 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 *MsgSetBridgeStatusResponse) Reset() { *m = MsgSetBridgeStatusResponse{} } +func (m *MsgSetBridgeStatusResponse) String() string { return proto.CompactTextString(m) } +func (*MsgSetBridgeStatusResponse) ProtoMessage() {} +func (*MsgSetBridgeStatusResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_54a336bc5ea063bb, []int{19} } -func (m *MsgResumeResponse) XXX_Unmarshal(b []byte) error { +func (m *MsgSetBridgeStatusResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgResumeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgSetBridgeStatusResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgResumeResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgSetBridgeStatusResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -1045,17 +969,17 @@ func (m *MsgResumeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, e return b[:n], nil } } -func (m *MsgResumeResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgResumeResponse.Merge(m, src) +func (m *MsgSetBridgeStatusResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSetBridgeStatusResponse.Merge(m, src) } -func (m *MsgResumeResponse) XXX_Size() int { +func (m *MsgSetBridgeStatusResponse) XXX_Size() int { return m.Size() } -func (m *MsgResumeResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgResumeResponse.DiscardUnknown(m) +func (m *MsgSetBridgeStatusResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSetBridgeStatusResponse.DiscardUnknown(m) } -var xxx_messageInfo_MsgResumeResponse proto.InternalMessageInfo +var xxx_messageInfo_MsgSetBridgeStatusResponse proto.InternalMessageInfo func init() { proto.RegisterType((*MsgTransfer)(nil), "lbm.fbridge.v1.MsgTransfer") @@ -1076,64 +1000,61 @@ func init() { 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") + proto.RegisterType((*MsgSetBridgeStatus)(nil), "lbm.fbridge.v1.MsgSetBridgeStatus") + proto.RegisterType((*MsgSetBridgeStatusResponse)(nil), "lbm.fbridge.v1.MsgSetBridgeStatusResponse") } func init() { proto.RegisterFile("lbm/fbridge/v1/tx.proto", fileDescriptor_54a336bc5ea063bb) } var fileDescriptor_54a336bc5ea063bb = []byte{ - // 757 bytes of a gzipped FileDescriptorProto + // 752 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, + 0x14, 0x4e, 0x6e, 0x42, 0x04, 0x07, 0x6e, 0xe0, 0xce, 0x85, 0x10, 0x4c, 0x48, 0xb8, 0xbe, 0xfd, + 0xa1, 0x48, 0x4d, 0x20, 0xad, 0x54, 0xa9, 0xbb, 0x06, 0x09, 0x15, 0x54, 0x8b, 0xca, 0xb4, 0x55, + 0xd5, 0x45, 0x91, 0x13, 0x4f, 0x06, 0xab, 0xb6, 0x27, 0xf5, 0x4c, 0xa2, 0x54, 0xea, 0x2b, 0x54, + 0xea, 0xc3, 0xf4, 0x21, 0x58, 0xb2, 0xac, 0xba, 0x40, 0x15, 0x3c, 0x44, 0xb7, 0x95, 0xcd, 0x64, + 0xb0, 0x8d, 0x9d, 0x80, 0xba, 0x9b, 0xc9, 0xf7, 0x73, 0xbe, 0x93, 0x99, 0x33, 0x09, 0x2c, 0xdb, + 0x6d, 0xa7, 0xd1, 0x6d, 0x7b, 0x96, 0x49, 0x70, 0x63, 0xb0, 0xdd, 0xe0, 0xc3, 0x7a, 0xcf, 0xa3, + 0x9c, 0xa2, 0xa2, 0xdd, 0x76, 0xea, 0x02, 0xa8, 0x0f, 0xb6, 0x95, 0x45, 0x42, 0x09, 0x0d, 0xa0, + 0x86, 0xbf, 0xba, 0x64, 0x29, 0x95, 0x98, 0x7c, 0x24, 0x08, 0x50, 0xf5, 0x4b, 0x16, 0x66, 0x35, + 0x46, 0x5e, 0x79, 0x86, 0xcb, 0xba, 0xd8, 0x43, 0x25, 0x28, 0x30, 0xec, 0x9a, 0xd8, 0x2b, 0x67, + 0xd7, 0xb3, 0x1b, 0x33, 0xba, 0xd8, 0x21, 0x05, 0xa6, 0x3d, 0xdc, 0xc1, 0xd6, 0x00, 0x7b, 0xe5, + 0xbf, 0x02, 0x44, 0xee, 0xd1, 0x3e, 0x14, 0x0c, 0x87, 0xf6, 0x5d, 0x5e, 0xce, 0xf9, 0x48, 0xab, + 0x79, 0x72, 0x56, 0xcb, 0xfc, 0x38, 0xab, 0x6d, 0x12, 0x8b, 0x1f, 0xf7, 0xdb, 0xf5, 0x0e, 0x75, + 0x1a, 0xbb, 0x96, 0xcb, 0x3a, 0xc7, 0x96, 0xd1, 0xe8, 0x8a, 0xc5, 0x43, 0x66, 0x7e, 0x68, 0xf0, + 0x4f, 0x3d, 0xcc, 0xea, 0x7b, 0x2e, 0xd7, 0x85, 0x83, 0xba, 0x04, 0xff, 0x86, 0xe2, 0xe8, 0x98, + 0xf5, 0xa8, 0xcb, 0xb0, 0xfa, 0x2d, 0x0b, 0x73, 0x1a, 0x23, 0x2f, 0x3d, 0x3a, 0xb0, 0x98, 0x45, + 0x5d, 0x84, 0x20, 0xdf, 0xf5, 0xa8, 0x23, 0x52, 0x06, 0x6b, 0xb4, 0x00, 0x39, 0x86, 0x3f, 0x06, + 0xf1, 0xf2, 0xba, 0xbf, 0x0c, 0x75, 0x93, 0x4b, 0xed, 0x26, 0x9f, 0xda, 0xcd, 0xd4, 0x1f, 0x77, + 0x53, 0x82, 0xc5, 0x70, 0x6a, 0xd9, 0xce, 0x13, 0x98, 0xd7, 0x18, 0x79, 0x4e, 0x6d, 0x53, 0x7e, + 0xf1, 0x37, 0x6a, 0x48, 0x5d, 0x81, 0xe5, 0x98, 0x50, 0x7a, 0x3e, 0x05, 0xa4, 0x31, 0xa2, 0x63, + 0x1b, 0x1b, 0x0c, 0xdf, 0xd2, 0xb6, 0x02, 0xca, 0x75, 0xed, 0x35, 0x67, 0x87, 0x0e, 0xf0, 0x2d, + 0x4f, 0x40, 0x3a, 0x47, 0xb4, 0xd2, 0xb9, 0x05, 0x7f, 0x6b, 0x8c, 0xec, 0xd8, 0x86, 0xe5, 0xb4, + 0x0c, 0xde, 0x39, 0x4e, 0x34, 0x5d, 0x03, 0x70, 0x8c, 0xe1, 0x51, 0xc7, 0x67, 0x31, 0xe1, 0x3d, + 0xe3, 0x18, 0xc3, 0x40, 0xc6, 0xd4, 0x65, 0x58, 0x8a, 0x78, 0x48, 0xf3, 0x2d, 0x98, 0x1e, 0x01, + 0x37, 0x0c, 0x8b, 0x60, 0x61, 0xa4, 0x90, 0x2e, 0x5d, 0x28, 0x6a, 0x8c, 0x1c, 0xf6, 0x09, 0xc1, + 0x8c, 0xeb, 0xd4, 0xc6, 0x89, 0x5e, 0x25, 0x28, 0x70, 0xc3, 0x23, 0x98, 0x8b, 0xe1, 0x10, 0x3b, + 0xb4, 0x01, 0x79, 0x8f, 0xda, 0x38, 0xb8, 0x7e, 0xc5, 0xe6, 0x62, 0x3d, 0x3a, 0xb1, 0x75, 0xdf, + 0x4f, 0x0f, 0x18, 0x6a, 0x19, 0x4a, 0xd1, 0x3a, 0x32, 0xc1, 0x67, 0xf8, 0x47, 0x63, 0xe4, 0x99, + 0x69, 0xbe, 0xa1, 0x1c, 0xef, 0x52, 0x2f, 0x35, 0x44, 0x0d, 0x66, 0x7b, 0x1e, 0xed, 0x51, 0x66, + 0xd8, 0x47, 0x96, 0x29, 0x1a, 0x83, 0xd1, 0x47, 0x7b, 0x26, 0x6a, 0x42, 0x81, 0xf6, 0xb8, 0x45, + 0x5d, 0x91, 0x47, 0x89, 0xe7, 0xf1, 0x2b, 0x1c, 0x04, 0x0c, 0x5d, 0x30, 0xd5, 0x55, 0x58, 0xb9, + 0x56, 0x3d, 0xf4, 0xe5, 0xf8, 0x37, 0xe3, 0x10, 0xf3, 0x56, 0x60, 0x71, 0xc8, 0x0d, 0xde, 0x67, + 0xfe, 0x74, 0x91, 0xbe, 0xe1, 0x99, 0x96, 0xe1, 0x8a, 0x7c, 0x72, 0x8f, 0x1e, 0x43, 0x81, 0x05, + 0xac, 0x20, 0x5e, 0xb1, 0x59, 0x89, 0x47, 0x08, 0x3b, 0xe9, 0x82, 0x2b, 0x6e, 0x51, 0xac, 0xce, + 0x28, 0x45, 0xf3, 0x57, 0x01, 0x72, 0x1a, 0x23, 0xe8, 0x05, 0x4c, 0xcb, 0x7b, 0xbf, 0x1a, 0xf7, + 0x0d, 0xbd, 0x2a, 0xca, 0xff, 0x63, 0xc0, 0x91, 0x2b, 0x3a, 0x80, 0x99, 0xab, 0xcb, 0x5e, 0x49, + 0x50, 0x48, 0x54, 0xb9, 0x33, 0x0e, 0x95, 0x86, 0x6f, 0x61, 0x2e, 0x32, 0xf1, 0xb5, 0x04, 0x55, + 0x98, 0xa0, 0xdc, 0x9f, 0x40, 0x90, 0xce, 0x06, 0xcc, 0xc7, 0xe7, 0x5e, 0x4d, 0xd0, 0xc6, 0x38, + 0xca, 0xe6, 0x64, 0x4e, 0xb4, 0x44, 0xf4, 0x01, 0x48, 0x2e, 0x11, 0xe1, 0xa4, 0x94, 0x48, 0x7c, + 0x0c, 0x90, 0x0e, 0x10, 0x7a, 0x09, 0xd6, 0x12, 0x94, 0x57, 0xb0, 0x72, 0x77, 0x2c, 0x2c, 0x3d, + 0x77, 0x60, 0xea, 0xf2, 0x01, 0x28, 0xa7, 0xf1, 0x95, 0xf5, 0x34, 0x44, 0x9a, 0xbc, 0x86, 0xd9, + 0xf0, 0xfc, 0x57, 0x13, 0x04, 0x21, 0x5c, 0xb9, 0x37, 0x1e, 0x97, 0xb6, 0xef, 0xa1, 0x18, 0x1b, + 0xea, 0xff, 0x12, 0x94, 0x51, 0x8a, 0xf2, 0x60, 0x22, 0x25, 0x7c, 0x64, 0xf1, 0xc9, 0x4c, 0x3a, + 0xb2, 0x18, 0x27, 0xf1, 0xc8, 0x52, 0x26, 0xaf, 0xb5, 0x7f, 0x72, 0x5e, 0xcd, 0x9e, 0x9e, 0x57, + 0xb3, 0x3f, 0xcf, 0xab, 0xd9, 0xaf, 0x17, 0xd5, 0xcc, 0xe9, 0x45, 0x35, 0xf3, 0xfd, 0xa2, 0x9a, + 0x79, 0xb7, 0x35, 0xf1, 0xd7, 0x72, 0x28, 0xff, 0x94, 0x04, 0xbf, 0x9b, 0xed, 0x42, 0xf0, 0x87, + 0xe4, 0xd1, 0xef, 0x00, 0x00, 0x00, 0xff, 0xff, 0xa9, 0xb2, 0x5f, 0xea, 0xef, 0x08, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1168,10 +1089,9 @@ type MsgClient interface { 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) + // SetBridgeStatus operates a switch to halt/resume the bridge module. + // If the ratio of inactive bridge switches exceed TrustLevel, the bridge module halts. + SetBridgeStatus(ctx context.Context, in *MsgSetBridgeStatus, opts ...grpc.CallOption) (*MsgSetBridgeStatusResponse, error) } type msgClient struct { @@ -1263,18 +1183,9 @@ func (c *msgClient) AddVoteForRole(ctx context.Context, in *MsgAddVoteForRole, o 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...) +func (c *msgClient) SetBridgeStatus(ctx context.Context, in *MsgSetBridgeStatus, opts ...grpc.CallOption) (*MsgSetBridgeStatusResponse, error) { + out := new(MsgSetBridgeStatusResponse) + err := c.cc.Invoke(ctx, "/lbm.fbridge.v1.Msg/SetBridgeStatus", in, out, opts...) if err != nil { return nil, err } @@ -1303,10 +1214,9 @@ type MsgServer interface { 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) + // SetBridgeStatus operates a switch to halt/resume the bridge module. + // If the ratio of inactive bridge switches exceed TrustLevel, the bridge module halts. + SetBridgeStatus(context.Context, *MsgSetBridgeStatus) (*MsgSetBridgeStatusResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -1340,11 +1250,8 @@ func (*UnimplementedMsgServer) SuggestRole(ctx context.Context, req *MsgSuggestR 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 (*UnimplementedMsgServer) SetBridgeStatus(ctx context.Context, req *MsgSetBridgeStatus) (*MsgSetBridgeStatusResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SetBridgeStatus not implemented") } func RegisterMsgServer(s grpc1.Server, srv MsgServer) { @@ -1513,38 +1420,20 @@ func _Msg_AddVoteForRole_Handler(srv interface{}, ctx context.Context, dec func( 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) +func _Msg_SetBridgeStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgSetBridgeStatus) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MsgServer).Resume(ctx, in) + return srv.(MsgServer).SetBridgeStatus(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/lbm.fbridge.v1.Msg/Resume", + FullMethod: "/lbm.fbridge.v1.Msg/SetBridgeStatus", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).Resume(ctx, req.(*MsgResume)) + return srv.(MsgServer).SetBridgeStatus(ctx, req.(*MsgSetBridgeStatus)) } return interceptor(ctx, in, info, handler) } @@ -1590,12 +1479,8 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ Handler: _Msg_AddVoteForRole_Handler, }, { - MethodName: "Halt", - Handler: _Msg_Halt_Handler, - }, - { - MethodName: "Resume", - Handler: _Msg_Resume_Handler, + MethodName: "SetBridgeStatus", + Handler: _Msg_SetBridgeStatus_Handler, }, }, Streams: []grpc.StreamDesc{}, @@ -2129,13 +2014,8 @@ func (m *MsgAddVoteForRole) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.Option { - i-- - if m.Option { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } + if m.Option != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Option)) i-- dAtA[i] = 0x18 } @@ -2177,7 +2057,7 @@ func (m *MsgAddVoteForRoleResponse) MarshalToSizedBuffer(dAtA []byte) (int, erro return len(dAtA) - i, nil } -func (m *MsgHalt) Marshal() (dAtA []byte, err error) { +func (m *MsgSetBridgeStatus) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2187,16 +2067,21 @@ func (m *MsgHalt) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgHalt) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgSetBridgeStatus) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgHalt) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgSetBridgeStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l + if m.Status != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Status)) + i-- + dAtA[i] = 0x10 + } if len(m.Guardian) > 0 { i -= len(m.Guardian) copy(dAtA[i:], m.Guardian) @@ -2207,60 +2092,7 @@ func (m *MsgHalt) MarshalToSizedBuffer(dAtA []byte) (int, error) { 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) { +func (m *MsgSetBridgeStatusResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2270,12 +2102,12 @@ func (m *MsgResumeResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgResumeResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgSetBridgeStatusResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgResumeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgSetBridgeStatusResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -2524,8 +2356,8 @@ func (m *MsgAddVoteForRole) Size() (n int) { if m.ProposalId != 0 { n += 1 + sovTx(uint64(m.ProposalId)) } - if m.Option { - n += 2 + if m.Option != 0 { + n += 1 + sovTx(uint64(m.Option)) } return n } @@ -2539,7 +2371,7 @@ func (m *MsgAddVoteForRoleResponse) Size() (n int) { return n } -func (m *MsgHalt) Size() (n int) { +func (m *MsgSetBridgeStatus) Size() (n int) { if m == nil { return 0 } @@ -2549,32 +2381,13 @@ func (m *MsgHalt) Size() (n int) { 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)) + if m.Status != 0 { + n += 1 + sovTx(uint64(m.Status)) } return n } -func (m *MsgResumeResponse) Size() (n int) { +func (m *MsgSetBridgeStatusResponse) Size() (n int) { if m == nil { return 0 } @@ -4058,7 +3871,7 @@ func (m *MsgAddVoteForRole) Unmarshal(dAtA []byte) error { if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Option", wireType) } - var v int + m.Option = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -4068,12 +3881,11 @@ func (m *MsgAddVoteForRole) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int(b&0x7F) << shift + m.Option |= VoteOption(b&0x7F) << shift if b < 0x80 { break } } - m.Option = bool(v != 0) default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -4145,7 +3957,7 @@ func (m *MsgAddVoteForRoleResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgHalt) Unmarshal(dAtA []byte) error { +func (m *MsgSetBridgeStatus) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4168,10 +3980,10 @@ func (m *MsgHalt) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgHalt: wiretype end group for non-group") + return fmt.Errorf("proto: MsgSetBridgeStatus: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgHalt: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgSetBridgeStatus: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -4206,111 +4018,11 @@ func (m *MsgHalt) Unmarshal(dAtA []byte) error { } 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) + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) } - var stringLen uint64 + m.Status = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -4320,24 +4032,11 @@ func (m *MsgResume) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.Status |= BridgeStatus(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:]) @@ -4359,7 +4058,7 @@ func (m *MsgResume) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgResumeResponse) Unmarshal(dAtA []byte) error { +func (m *MsgSetBridgeStatusResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4382,10 +4081,10 @@ func (m *MsgResumeResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgResumeResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgSetBridgeStatusResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgResumeResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgSetBridgeStatusResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: