From 547c5d65118f49bbe3c22070a736c64d93d68fcd Mon Sep 17 00:00:00 2001 From: "jaeseung.bae" Date: Tue, 30 Apr 2024 16:17:40 +0900 Subject: [PATCH] chore: change old/new to from/to --- docs/core/proto-docs.md | 32 ++--- proto/lbm/fswap/v1/event.proto | 8 +- proto/lbm/fswap/v1/fswap.proto | 6 +- proto/lbm/fswap/v1/query.proto | 19 +-- proto/lbm/fswap/v1/tx.proto | 2 +- x/fswap/client/cli/query.go | 2 +- x/fswap/keeper/grpc_query.go | 12 +- x/fswap/keeper/keeper.go | 20 +-- x/fswap/types/event.pb.go | 71 +++++----- x/fswap/types/fswap.go | 8 +- x/fswap/types/fswap.pb.go | 86 ++++++------ x/fswap/types/genesis.go | 2 +- x/fswap/types/query.pb.go | 232 +++++++++++++++++---------------- x/fswap/types/query.pb.gw.go | 28 ++-- x/fswap/types/tx.pb.go | 2 +- 15 files changed, 268 insertions(+), 262 deletions(-) diff --git a/docs/core/proto-docs.md b/docs/core/proto-docs.md index 7a5798c5c3..684b66a19e 100644 --- a/docs/core/proto-docs.md +++ b/docs/core/proto-docs.md @@ -870,8 +870,8 @@ - [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) + - [QueryTotalSwappableToCoinAmountRequest](#lbm.fswap.v1.QueryTotalSwappableToCoinAmountRequest) + - [QueryTotalSwappableToCoinAmountResponse](#lbm.fswap.v1.QueryTotalSwappableToCoinAmountResponse) - [Query](#lbm.fswap.v1.Query) @@ -12726,8 +12726,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 | +| `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 | @@ -12793,8 +12793,8 @@ From cosmos-sdk 0.46.0 they deprecated this way, but currently finschia-sdk base | 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) | | | +| `from_coin_amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +| `to_coin_amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | @@ -12867,17 +12867,17 @@ GenesisState defines the fswap module's genesis state. | 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) | | | +| `from_coin_amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +| `to_coin_amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | - + -### QueryTotalSwappableAmountRequest +### QueryTotalSwappableToCoinAmountRequest @@ -12885,15 +12885,15 @@ GenesisState defines the fswap module's genesis state. - + -### 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) | | | @@ -12913,8 +12913,8 @@ 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) | Swapped queries the current swapped status that includes a burnt amount of old coin and a minted amount of new coin. | GET|/lbm/fswap/v1/swapped| -| `TotalSwappableAmount` | [QueryTotalSwappableAmountRequest](#lbm.fswap.v1.QueryTotalSwappableAmountRequest) | [QueryTotalSwappableAmountResponse](#lbm.fswap.v1.QueryTotalSwappableAmountResponse) | TotalSwappableAmount queries the current swappable amount for new coin. | 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/swappable_new_coin_amount| @@ -12961,7 +12961,7 @@ GenesisState defines the fswap module's genesis state. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | `from_address` | [string](#string) | | holder's address | -| `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | amount of old currency | +| `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | from-coin amount | diff --git a/proto/lbm/fswap/v1/event.proto b/proto/lbm/fswap/v1/event.proto index 374447f7c3..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_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"]; - // amount of the new currency - cosmos.base.v1beta1.Coin new_coin_amount = 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 cfc2826a6f..1216ceca57 100644 --- a/proto/lbm/fswap/v1/fswap.proto +++ b/proto/lbm/fswap/v1/fswap.proto @@ -29,9 +29,9 @@ message SwapInitProposal { } message Swapped { - option (gogoproto.goproto_stringer) = false; - cosmos.base.v1beta1.Coin old_coin_amount = 1 + 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 new_coin_amount = 2 + 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/query.proto b/proto/lbm/fswap/v1/query.proto index 2ef950bd79..09ca077261 100644 --- a/proto/lbm/fswap/v1/query.proto +++ b/proto/lbm/fswap/v1/query.proto @@ -9,27 +9,28 @@ 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 old coin and a minted amount of new - // coin. + // 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"; } - // TotalSwappableAmount queries the current swappable amount for new coin. - rpc TotalSwappableAmount(QueryTotalSwappableAmountRequest) returns (QueryTotalSwappableAmountResponse) { + // TotalSwappableToCoinAmount queries the current swappable amount for to-coin. + rpc TotalSwappableToCoinAmount(QueryTotalSwappableToCoinAmountRequest) + returns (QueryTotalSwappableToCoinAmountResponse) { option (google.api.http).get = "/lbm/fswap/v1/swappable_new_coin_amount"; } } message QuerySwappedRequest {} message QuerySwappedResponse { - cosmos.base.v1beta1.Coin old_coin_amount = 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_amount = 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 {} +message QueryTotalSwappableToCoinAmountResponse { + cosmos.base.v1beta1.Coin swappable_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 index c9b3c171bc..149abf400a 100644 --- a/proto/lbm/fswap/v1/tx.proto +++ b/proto/lbm/fswap/v1/tx.proto @@ -14,7 +14,7 @@ service Msg { message MsgSwapRequest { // holder's address string from_address = 1; - // amount of old currency + // from-coin amount cosmos.base.v1beta1.Coin amount = 2 [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/Finschia/finschia-sdk/types.Coin"]; } diff --git a/x/fswap/client/cli/query.go b/x/fswap/client/cli/query.go index f92118cfe3..feddf7dc1f 100644 --- a/x/fswap/client/cli/query.go +++ b/x/fswap/client/cli/query.go @@ -65,7 +65,7 @@ func CmdQueryTotalSwappableAmount() *cobra.Command { } queryClient := types.NewQueryClient(clientCtx) - res, err := queryClient.TotalSwappableAmount(cmd.Context(), &types.QueryTotalSwappableAmountRequest{}) + res, err := queryClient.TotalSwappableToCoinAmount(cmd.Context(), &types.QueryTotalSwappableToCoinAmountRequest{}) if err != nil { return err } diff --git a/x/fswap/keeper/grpc_query.go b/x/fswap/keeper/grpc_query.go index 5f8952f8aa..e94c1c78f5 100644 --- a/x/fswap/keeper/grpc_query.go +++ b/x/fswap/keeper/grpc_query.go @@ -26,18 +26,18 @@ func (s QueryServer) Swapped(ctx context.Context, _ *types.QuerySwappedRequest) return nil, err } return &types.QuerySwappedResponse{ - OldCoinAmount: swapped.GetOldCoinAmount(), - NewCoinAmount: swapped.GetNewCoinAmount(), + FromCoinAmount: swapped.GetFromCoinAmount(), + ToCoinAmount: swapped.GetToCoinAmount(), }, nil } -func (s QueryServer) TotalSwappableAmount(ctx context.Context, _ *types.QueryTotalSwappableAmountRequest) (*types.QueryTotalSwappableAmountResponse, error) { +func (s QueryServer) TotalSwappableToCoinAmount(ctx context.Context, _ *types.QueryTotalSwappableToCoinAmountRequest) (*types.QueryTotalSwappableToCoinAmountResponse, error) { c := sdk.UnwrapSDKContext(ctx) amount, err := s.Keeper.getSwappableNewCoinAmount(c) if err != nil { - return &types.QueryTotalSwappableAmountResponse{}, err + return &types.QueryTotalSwappableToCoinAmountResponse{}, err } - return &types.QueryTotalSwappableAmountResponse{ - SwappableNewCoin: amount, + return &types.QueryTotalSwappableToCoinAmountResponse{ + SwappableAmount: amount, }, nil } diff --git a/x/fswap/keeper/keeper.go b/x/fswap/keeper/keeper.go index b164bd2fb4..91dbcc98c4 100644 --- a/x/fswap/keeper/keeper.go +++ b/x/fswap/keeper/keeper.go @@ -55,11 +55,11 @@ func (k Keeper) SwapInit(ctx sdk.Context, swapInit types.SwapInit) error { return err } swapped := types.Swapped{ - OldCoinAmount: sdk.Coin{ + FromCoinAmount: sdk.Coin{ Denom: swapInit.GetFromDenom(), Amount: sdk.ZeroInt(), }, - NewCoinAmount: sdk.Coin{ + ToCoinAmount: sdk.Coin{ Denom: swapInit.GetToDenom(), Amount: sdk.ZeroInt(), }, @@ -110,9 +110,9 @@ func (k Keeper) Swap(ctx sdk.Context, addr sdk.AccAddress, oldCoinAmount sdk.Coi } if err := ctx.EventManager().EmitTypedEvent(&types.EventSwapCoins{ - Address: addr.String(), - OldCoinAmount: oldCoinAmount, - NewCoinAmount: newCoinAmount, + Address: addr.String(), + FromCoinAmount: oldCoinAmount, + ToCoinAmount: newCoinAmount, }); err != nil { return err } @@ -190,7 +190,7 @@ func (k Keeper) getSwapped(ctx sdk.Context) (types.Swapped, error) { func (k Keeper) setSwapped(ctx sdk.Context, swapped types.Swapped) error { store := ctx.KVStore(k.storeKey) - key := swappedKey(swapped.NewCoinAmount.Denom) + key := swappedKey(swapped.ToCoinAmount.Denom) bz, err := k.cdc.Marshal(&swapped) if err != nil { return err @@ -238,7 +238,7 @@ func (k Keeper) getSwappableNewCoinAmount(ctx sdk.Context) (sdk.Coin, error) { return sdk.Coin{}, err } - remainingAmount := swapCap.Sub(swapped.GetNewCoinAmount().Amount) + remainingAmount := swapCap.Sub(swapped.GetToCoinAmount().Amount) return sdk.NewCoin(denom, remainingAmount), nil } @@ -304,8 +304,8 @@ func (k Keeper) updateSwapped(ctx sdk.Context, oldAmount, newAmount sdk.Coin) er return err } updatedSwapped := &types.Swapped{ - OldCoinAmount: oldAmount.Add(prevSwapped.OldCoinAmount), - NewCoinAmount: newAmount.Add(prevSwapped.NewCoinAmount), + FromCoinAmount: oldAmount.Add(prevSwapped.FromCoinAmount), + ToCoinAmount: newAmount.Add(prevSwapped.ToCoinAmount), } store := ctx.KVStore(k.storeKey) @@ -328,7 +328,7 @@ func (k Keeper) checkSwapCap(ctx sdk.Context, newCoinAmount sdk.Coin) error { return err } - if swapCap.LT(swapped.NewCoinAmount.Add(newCoinAmount).Amount) { + if swapCap.LT(swapped.ToCoinAmount.Add(newCoinAmount).Amount) { return fmt.Errorf("cann't swap more because of swapCap limit, amount=%s", newCoinAmount.String()) } diff --git a/x/fswap/types/event.pb.go b/x/fswap/types/event.pb.go index 5808cc6e7f..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 - 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"` + // 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) GetOldCoinAmount() types.Coin { +func (m *EventSwapCoins) GetFromCoinAmount() types.Coin { if m != nil { - return m.OldCoinAmount + return m.FromCoinAmount } return types.Coin{} } -func (m *EventSwapCoins) GetNewCoinAmount() types.Coin { +func (m *EventSwapCoins) GetToCoinAmount() types.Coin { if m != nil { - return m.NewCoinAmount + 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{ - // 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, + // 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,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d, 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.NewCoinAmount.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.OldCoinAmount.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.OldCoinAmount.Size() + l = m.FromCoinAmount.Size() n += 1 + l + sovEvent(uint64(l)) - l = m.NewCoinAmount.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 OldCoinAmount", 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.OldCoinAmount.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 NewCoinAmount", 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.NewCoinAmount.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/fswap.go b/x/fswap/types/fswap.go index 722e8c46a5..8c226e0425 100644 --- a/x/fswap/types/fswap.go +++ b/x/fswap/types/fswap.go @@ -14,8 +14,8 @@ func NewSwapped( newCoinAmount sdk.Coin, ) Swapped { return Swapped{ - OldCoinAmount: oldCoinAmount, - NewCoinAmount: newCoinAmount, + FromCoinAmount: oldCoinAmount, + ToCoinAmount: newCoinAmount, } } @@ -40,10 +40,10 @@ func validateCoinAmount(i interface{}) error { // Validate validates the set of swapped func (s Swapped) Validate() error { - if err := validateCoinAmount(s.OldCoinAmount); err != nil { + if err := validateCoinAmount(s.FromCoinAmount); err != nil { return err } - if err := validateCoinAmount(s.NewCoinAmount); err != nil { + if err := validateCoinAmount(s.ToCoinAmount); err != nil { return err } return nil diff --git a/x/fswap/types/fswap.pb.go b/x/fswap/types/fswap.pb.go index 9b50fa5406..f406f4dc63 100644 --- a/x/fswap/types/fswap.pb.go +++ b/x/fswap/types/fswap.pb.go @@ -139,8 +139,8 @@ func (m *SwapInitProposal) GetSwapInit() SwapInit { } 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"` + 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 *Swapped) Reset() { *m = Swapped{} } @@ -175,16 +175,16 @@ func (m *Swapped) XXX_DiscardUnknown() { var xxx_messageInfo_Swapped proto.InternalMessageInfo -func (m *Swapped) GetOldCoinAmount() types.Coin { +func (m *Swapped) GetFromCoinAmount() types.Coin { if m != nil { - return m.OldCoinAmount + return m.FromCoinAmount } return types.Coin{} } -func (m *Swapped) GetNewCoinAmount() types.Coin { +func (m *Swapped) GetToCoinAmount() types.Coin { if m != nil { - return m.NewCoinAmount + return m.ToCoinAmount } return types.Coin{} } @@ -199,35 +199,35 @@ func init() { proto.RegisterFile("lbm/fswap/v1/fswap.proto", fileDescriptor_42ca var fileDescriptor_42ca60eaf37a2b67 = []byte{ // 465 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x53, 0xbf, 0x6f, 0xd3, 0x40, - 0x14, 0xb6, 0x43, 0xa0, 0xc9, 0xa5, 0x15, 0xc8, 0x54, 0x90, 0x56, 0xc2, 0xae, 0x3a, 0x21, 0x10, - 0x77, 0x4a, 0x3a, 0xd1, 0x8d, 0x14, 0x55, 0x74, 0x40, 0x42, 0x01, 0x09, 0x89, 0xc5, 0x3a, 0xdb, - 0x97, 0xe4, 0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0xb8, 0x30, 0x78, - 0x72, 0xb6, 0x88, 0xc3, 0xf3, 0x45, 0x1c, 0x7e, 0x5b, 0xc4, 0xe1, 0xfb, 0x65, 0x1c, 0x9c, 0x2f, - 0xe3, 0xe0, 0xf3, 0x32, 0x0e, 0x5e, 0xe1, 0xbf, 0x72, 0xbf, 0xf1, 0xcf, 0xc7, 0x6a, 0x64, 0xd7, - 0xec, 0x8f, 0x7f, 0xf0, 0x33, 0x00, 0x00, 0xff, 0xff, 0x28, 0x05, 0xbc, 0x8c, 0x58, 0x03, 0x00, + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x53, 0x3d, 0x6f, 0x13, 0x41, + 0x10, 0xf5, 0x19, 0x43, 0xec, 0xb5, 0x89, 0xa2, 0x23, 0x02, 0x27, 0x12, 0x77, 0x51, 0x2a, 0x04, + 0x62, 0x57, 0x76, 0x2a, 0xd2, 0xe1, 0xa0, 0x88, 0x14, 0x48, 0xc8, 0x20, 0x21, 0xd1, 0x9c, 0xf6, + 0xce, 0x67, 0x7b, 0xc5, 0xdd, 0xce, 0xea, 0x76, 0xec, 0x84, 0x5f, 0x01, 0x74, 0x94, 0xa9, 0xf9, + 0x25, 0x29, 0x53, 0x22, 0x8a, 0x80, 0xec, 0x86, 0x7f, 0x01, 0xda, 0x8f, 0x80, 0xa9, 0x40, 0x48, + 0xe9, 0x66, 0xe7, 0xcd, 0xbd, 0x37, 0xfb, 0xde, 0x2d, 0xe9, 0x16, 0x69, 0xc9, 0xc6, 0xfa, 0x98, + 0x2b, 0x36, 0xef, 0xb9, 0x82, 0xaa, 0x0a, 0x10, 0xc2, 0x4e, 0x91, 0x96, 0xd4, 0x35, 0xe6, 0xbd, + 0xed, 0xcd, 0x09, 0x4c, 0xc0, 0x02, 0xcc, 0x54, 0x6e, 0x66, 0x3b, 0xca, 0x40, 0x97, 0xa0, 0x59, + 0xca, 0x75, 0xce, 0xe6, 0xbd, 0x34, 0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11, 0x69, 0xd9, + 0x7d, 0x85, 0x14, 0x68, 0xbd, 0x68, 0xf7, 0x6f, 0xd3, 0xd5, 0xe0, 0xe8, 0xa5, 0xd4, 0xa0, 0x61, + 0xee, 0x30, 0x6c, 0x6a, 0x7f, 0x5e, 0xd9, 0xe8, 0x47, 0x40, 0xd6, 0xcc, 0x98, 0xca, 0x47, 0xe1, + 0x09, 0xd9, 0xb0, 0x21, 0x99, 0x10, 0x13, 0xe7, 0x90, 0xdd, 0xa9, 0xdd, 0xdf, 0xa2, 0x2e, 0x6c, + 0x6a, 0xc2, 0xa6, 0x3e, 0x6c, 0x7a, 0x00, 0x42, 0x0e, 0xf6, 0x0c, 0xf5, 0xa7, 0xaf, 0xf1, 0x83, + 0x7f, 0xb4, 0xc7, 0x7c, 0x34, 0x5c, 0x37, 0x3a, 0xa6, 0x7a, 0x6c, 0x55, 0x42, 0x24, 0xeb, 0x08, + 0x7f, 0xe8, 0xd6, 0xaf, 0x44, 0xb7, 0x83, 0xf0, 0x5b, 0x75, 0xbf, 0x61, 0x5c, 0x18, 0x3c, 0x3d, + 0x5b, 0x44, 0xc1, 0xf9, 0x22, 0x0a, 0xbe, 0x2d, 0xa2, 0xe0, 0xfd, 0x32, 0xaa, 0x9d, 0x2f, 0xa3, + 0xda, 0xe7, 0x65, 0x54, 0x7b, 0x4d, 0xff, 0x4a, 0x7d, 0xe2, 0x9f, 0x8f, 0x95, 0x48, 0x6f, 0xd8, + 0x1f, 0x7f, 0xef, 0x67, 0x00, 0x00, 0x00, 0xff, 0xff, 0x7f, 0x63, 0xad, 0x91, 0x58, 0x03, 0x00, 0x00, } @@ -419,7 +419,7 @@ func (m *Swapped) MarshalToSizedBuffer(dAtA []byte) (int, error) { var l int _ = l { - size, err := m.NewCoinAmount.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.ToCoinAmount.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -429,7 +429,7 @@ func (m *Swapped) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x12 { - size, err := m.OldCoinAmount.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.FromCoinAmount.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -498,9 +498,9 @@ func (m *Swapped) Size() (n int) { } 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 } @@ -871,7 +871,7 @@ func (m *Swapped) Unmarshal(dAtA []byte) error { 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 FromCoinAmount", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -898,13 +898,13 @@ func (m *Swapped) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.OldCoinAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + 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 NewCoinAmount", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ToCoinAmount", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -931,7 +931,7 @@ func (m *Swapped) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.NewCoinAmount.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/genesis.go b/x/fswap/types/genesis.go index 9304fa6732..505efab380 100644 --- a/x/fswap/types/genesis.go +++ b/x/fswap/types/genesis.go @@ -37,7 +37,7 @@ func (gs GenesisState) Validate() error { return err } - if swapInit.AmountCapForToDenom.LT(swapped.GetNewCoinAmount().Amount) { + if swapInit.AmountCapForToDenom.LT(swapped.GetToCoinAmount().Amount) { return ErrExceedSwappable } return nil diff --git a/x/fswap/types/query.pb.go b/x/fswap/types/query.pb.go index 8a69ac7609..3478a1db06 100644 --- a/x/fswap/types/query.pb.go +++ b/x/fswap/types/query.pb.go @@ -67,8 +67,8 @@ func (m *QuerySwappedRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QuerySwappedRequest proto.InternalMessageInfo type QuerySwappedResponse 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"` + 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 +104,37 @@ func (m *QuerySwappedResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QuerySwappedResponse proto.InternalMessageInfo -func (m *QuerySwappedResponse) GetOldCoinAmount() types.Coin { +func (m *QuerySwappedResponse) GetFromCoinAmount() types.Coin { if m != nil { - return m.OldCoinAmount + return m.FromCoinAmount } return types.Coin{} } -func (m *QuerySwappedResponse) GetNewCoinAmount() types.Coin { +func (m *QuerySwappedResponse) GetToCoinAmount() types.Coin { if m != nil { - return m.NewCoinAmount + return m.ToCoinAmount } return types.Coin{} } -type QueryTotalSwappableAmountRequest struct { +type QueryTotalSwappableToCoinAmountRequest struct { } -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 +144,36 @@ 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 -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,21 +183,21 @@ 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{} } @@ -201,42 +205,42 @@ func (m *QueryTotalSwappableAmountResponse) GetSwappableNewCoin() 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") + proto.RegisterType((*QueryTotalSwappableToCoinAmountRequest)(nil), "lbm.fswap.v1.QueryTotalSwappableToCoinAmountRequest") + proto.RegisterType((*QueryTotalSwappableToCoinAmountResponse)(nil), "lbm.fswap.v1.QueryTotalSwappableToCoinAmountResponse") } 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, 0xb4, 0x93, 0xc1, 0xaa, 0xd3, 0x40, - 0x14, 0x86, 0x93, 0x80, 0x0a, 0xa3, 0xa2, 0x8c, 0xbd, 0x78, 0x0d, 0x9a, 0x7b, 0x6f, 0x36, 0x2a, - 0xe2, 0x0c, 0xb9, 0xf7, 0x09, 0xac, 0x20, 0xae, 0x04, 0xab, 0x2b, 0x37, 0x65, 0x92, 0x4c, 0xd3, - 0x60, 0x32, 0x27, 0xed, 0x4c, 0x12, 0x0b, 0xae, 0x5c, 0xb8, 0x16, 0x7c, 0x02, 0x71, 0x23, 0x3e, - 0x49, 0x97, 0x05, 0x37, 0xae, 0x54, 0x5a, 0x1f, 0x44, 0x32, 0x99, 0xaa, 0x81, 0x50, 0xdd, 0x74, - 0x77, 0x98, 0xff, 0x64, 0xbe, 0x7f, 0xfe, 0x73, 0x82, 0x0e, 0xb3, 0x30, 0xa7, 0x13, 0x59, 0xb3, - 0x82, 0x56, 0x01, 0x9d, 0x95, 0x7c, 0xbe, 0x20, 0xc5, 0x1c, 0x14, 0xe0, 0x4b, 0x59, 0x98, 0x13, - 0xad, 0x90, 0x2a, 0x70, 0x6f, 0x26, 0x00, 0x49, 0xc6, 0x29, 0x2b, 0x52, 0xca, 0x84, 0x00, 0xc5, - 0x54, 0x0a, 0x42, 0xb6, 0xbd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0xdf, 0xa4, 0x27, 0xed, - 0x6b, 0x4e, 0x3f, 0x3a, 0xe8, 0x9c, 0xf6, 0x88, 0x01, 0x5d, 0x30, 0x43, 0xc5, 0x27, 0xe4, 0xef, - 0xcd, 0x23, 0x3d, 0x8b, 0xe0, 0xfa, 0xbb, 0x5a, 0xda, 0x97, 0xf9, 0xb7, 0xde, 0x7c, 0xf9, 0xf9, - 0xde, 0xb9, 0x8e, 0x0f, 0x68, 0x67, 0xcd, 0xa4, 0xa1, 0x7c, 0xb2, 0xd1, 0xa0, 0x2f, 0x19, 0x4c, - 0x7a, 0xee, 0xde, 0x91, 0xb3, 0x4b, 0xff, 0xbb, 0xdf, 0x18, 0xa3, 0xda, 0xd8, 0x5d, 0x7c, 0xbb, - 0xc7, 0x58, 0x67, 0x0c, 0x66, 0xa5, 0x86, 0x8f, 0x97, 0x6b, 0xcf, 0x5e, 0xad, 0x3d, 0xfb, 0xc7, - 0xda, 0xb3, 0xdf, 0x6d, 0x3c, 0x6b, 0xb5, 0xf1, 0xac, 0xaf, 0x1b, 0xcf, 0x7a, 0x41, 0xfe, 0x19, - 0xff, 0x2b, 0x03, 0xd0, 0x63, 0x08, 0xcf, 0xeb, 0xdf, 0xeb, 0xec, 0x57, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x63, 0x79, 0x56, 0x3c, 0xf6, 0x03, 0x00, 0x00, + // 444 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x93, 0x3f, 0x8f, 0xd3, 0x30, + 0x18, 0xc6, 0x93, 0x48, 0x80, 0x64, 0x4e, 0xc7, 0xc9, 0xdc, 0x89, 0x23, 0x82, 0x1c, 0x64, 0xe0, + 0x0e, 0x21, 0x6c, 0xa5, 0x85, 0x0f, 0x40, 0x91, 0x10, 0x2b, 0xa5, 0x13, 0x4b, 0xe5, 0xa4, 0x6e, + 0x1a, 0x91, 0xf8, 0x4d, 0x6b, 0xa7, 0x7f, 0x56, 0x06, 0x66, 0x24, 0xbe, 0x02, 0x13, 0x3b, 0x0b, + 0x9f, 0xa0, 0x63, 0x25, 0x16, 0x26, 0x40, 0x2d, 0x1f, 0x04, 0xc5, 0x71, 0xa1, 0x91, 0x0a, 0x15, + 0x43, 0xb7, 0x57, 0x7e, 0x1f, 0xe7, 0xf7, 0xe4, 0x79, 0x5f, 0xa3, 0xd3, 0x34, 0xcc, 0x68, 0x5f, + 0x4e, 0x58, 0x4e, 0xc7, 0x01, 0x1d, 0x16, 0x7c, 0x34, 0x23, 0xf9, 0x08, 0x14, 0xe0, 0x83, 0x34, + 0xcc, 0x88, 0xee, 0x90, 0x71, 0xe0, 0xde, 0x8a, 0x01, 0xe2, 0x94, 0x53, 0x96, 0x27, 0x94, 0x09, + 0x01, 0x8a, 0xa9, 0x04, 0x84, 0xac, 0xb4, 0xee, 0x71, 0x0c, 0x31, 0xe8, 0x92, 0x96, 0x95, 0x39, + 0xf5, 0x22, 0x90, 0x19, 0x48, 0x1a, 0x32, 0xc9, 0xe9, 0x38, 0x08, 0xb9, 0x62, 0x01, 0x8d, 0x20, + 0x11, 0xa6, 0x5f, 0x67, 0x57, 0x28, 0xdd, 0xf1, 0x4f, 0xd0, 0xf5, 0x17, 0xa5, 0x95, 0x97, 0x13, + 0x96, 0xe7, 0xbc, 0xd7, 0xe6, 0xc3, 0x82, 0x4b, 0xe5, 0xbf, 0x75, 0xd0, 0x71, 0xfd, 0x5c, 0xe6, + 0x20, 0x24, 0xc7, 0x53, 0x74, 0xd4, 0x1f, 0x41, 0xd6, 0x2d, 0x3f, 0xde, 0x65, 0x19, 0x14, 0x42, + 0x9d, 0xda, 0x77, 0xec, 0x8b, 0xab, 0x8d, 0x9b, 0xa4, 0x32, 0x41, 0x4a, 0x13, 0xc4, 0x98, 0x20, + 0x4f, 0x21, 0x11, 0xad, 0xe6, 0xfc, 0xdb, 0x99, 0xf5, 0xf1, 0xfb, 0xd9, 0x83, 0x38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0xd9, 0x39, 0x8f, 0xa9, 0x01, 0xe8, 0xb9, 0x84, 0x97, 0xf5, 0xcb, 0x6b, 0xfe, 0x0a, + 0x00, 0x00, 0xff, 0xff, 0x8c, 0x3e, 0xc5, 0x8e, 0x11, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -251,11 +255,11 @@ 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 old coin and a minted amount of new - // coin. + // 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) - // TotalSwappableAmount queries the current swappable amount for new coin. - TotalSwappableAmount(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) } type queryClient struct { @@ -275,9 +279,9 @@ func (c *queryClient) Swapped(ctx context.Context, in *QuerySwappedRequest, opts return out, nil } -func (c *queryClient) TotalSwappableAmount(ctx context.Context, in *QueryTotalSwappableAmountRequest, opts ...grpc.CallOption) (*QueryTotalSwappableAmountResponse, error) { - out := new(QueryTotalSwappableAmountResponse) - err := c.cc.Invoke(ctx, "/lbm.fswap.v1.Query/TotalSwappableAmount", 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 } @@ -286,11 +290,11 @@ func (c *queryClient) TotalSwappableAmount(ctx context.Context, in *QueryTotalSw // QueryServer is the server API for Query service. type QueryServer interface { - // Swapped queries the current swapped status that includes a burnt amount of old coin and a minted amount of new - // coin. + // 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) - // TotalSwappableAmount queries the current swappable amount for new coin. - TotalSwappableAmount(context.Context, *QueryTotalSwappableAmountRequest) (*QueryTotalSwappableAmountResponse, error) + // TotalSwappableToCoinAmount queries the current swappable amount for to-coin. + TotalSwappableToCoinAmount(context.Context, *QueryTotalSwappableToCoinAmountRequest) (*QueryTotalSwappableToCoinAmountResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -300,8 +304,8 @@ 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) TotalSwappableAmount(ctx context.Context, req *QueryTotalSwappableAmountRequest) (*QueryTotalSwappableAmountResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method TotalSwappableAmount not implemented") +func (*UnimplementedQueryServer) TotalSwappableToCoinAmount(ctx context.Context, req *QueryTotalSwappableToCoinAmountRequest) (*QueryTotalSwappableToCoinAmountResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method TotalSwappableToCoinAmount not implemented") } func RegisterQueryServer(s grpc1.Server, srv QueryServer) { @@ -326,20 +330,20 @@ func _Query_Swapped_Handler(srv interface{}, ctx context.Context, dec func(inter return interceptor(ctx, in, info, handler) } -func _Query_TotalSwappableAmount_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).TotalSwappableAmount(ctx, in) + return srv.(QueryServer).TotalSwappableToCoinAmount(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/lbm.fswap.v1.Query/TotalSwappableAmount", + FullMethod: "/lbm.fswap.v1.Query/TotalSwappableToCoinAmount", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).TotalSwappableAmount(ctx, req.(*QueryTotalSwappableAmountRequest)) + return srv.(QueryServer).TotalSwappableToCoinAmount(ctx, req.(*QueryTotalSwappableToCoinAmountRequest)) } return interceptor(ctx, in, info, handler) } @@ -353,8 +357,8 @@ var _Query_serviceDesc = grpc.ServiceDesc{ Handler: _Query_Swapped_Handler, }, { - MethodName: "TotalSwappableAmount", - Handler: _Query_TotalSwappableAmount_Handler, + MethodName: "TotalSwappableToCoinAmount", + Handler: _Query_TotalSwappableToCoinAmount_Handler, }, }, Streams: []grpc.StreamDesc{}, @@ -405,7 +409,7 @@ func (m *QuerySwappedResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { var l int _ = l { - size, err := m.NewCoinAmount.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.ToCoinAmount.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -415,7 +419,7 @@ func (m *QuerySwappedResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x12 { - size, err := m.OldCoinAmount.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.FromCoinAmount.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -427,7 +431,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]) @@ -437,12 +441,12 @@ 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 @@ -450,7 +454,7 @@ func (m *QueryTotalSwappableAmountRequest) MarshalToSizedBuffer(dAtA []byte) (in 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]) @@ -460,18 +464,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 } @@ -509,14 +513,14 @@ func (m *QuerySwappedResponse) Size() (n int) { } var l int _ = l - l = m.OldCoinAmount.Size() + l = m.FromCoinAmount.Size() n += 1 + l + sovQuery(uint64(l)) - l = m.NewCoinAmount.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 } @@ -525,13 +529,13 @@ func (m *QueryTotalSwappableAmountRequest) Size() (n int) { 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 } @@ -623,7 +627,7 @@ func (m *QuerySwappedResponse) Unmarshal(dAtA []byte) error { 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 FromCoinAmount", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -650,13 +654,13 @@ func (m *QuerySwappedResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.OldCoinAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + 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 NewCoinAmount", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ToCoinAmount", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -683,7 +687,7 @@ func (m *QuerySwappedResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.NewCoinAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.ToCoinAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -708,7 +712,7 @@ func (m *QuerySwappedResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryTotalSwappableAmountRequest) Unmarshal(dAtA []byte) error { +func (m *QueryTotalSwappableToCoinAmountRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -731,10 +735,10 @@ 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: QueryTotalSwappableToCoinAmountRequest: 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: QueryTotalSwappableToCoinAmountRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -758,7 +762,7 @@ func (m *QueryTotalSwappableAmountRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryTotalSwappableAmountResponse) Unmarshal(dAtA []byte) error { +func (m *QueryTotalSwappableToCoinAmountResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -781,15 +785,15 @@ 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: QueryTotalSwappableToCoinAmountResponse: 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: 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 SwappableNewCoin", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field SwappableAmount", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -816,7 +820,7 @@ func (m *QueryTotalSwappableAmountResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.SwappableNewCoin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.SwappableAmount.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 fb7cadac5d..b657b521fd 100644 --- a/x/fswap/types/query.pb.gw.go +++ b/x/fswap/types/query.pb.gw.go @@ -49,20 +49,20 @@ func local_request_Query_Swapped_0(ctx context.Context, marshaler runtime.Marsha } -func request_Query_TotalSwappableAmount_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryTotalSwappableAmountRequest +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 - msg, err := client.TotalSwappableAmount(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.TotalSwappableToCoinAmount(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_TotalSwappableAmount_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryTotalSwappableAmountRequest +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 := server.TotalSwappableAmount(ctx, &protoReq) + msg, err := server.TotalSwappableToCoinAmount(ctx, &protoReq) return msg, metadata, err } @@ -93,7 +93,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) - mux.Handle("GET", pattern_Query_TotalSwappableAmount_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 +102,14 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_TotalSwappableAmount_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_TotalSwappableAmount_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_TotalSwappableToCoinAmount_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -174,7 +174,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) - mux.Handle("GET", pattern_Query_TotalSwappableAmount_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 +183,14 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_TotalSwappableAmount_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_TotalSwappableAmount_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_TotalSwappableToCoinAmount_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -200,11 +200,11 @@ 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_TotalSwappableAmount_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", "swappable_new_coin_amount"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( forward_Query_Swapped_0 = runtime.ForwardResponseMessage - forward_Query_TotalSwappableAmount_0 = runtime.ForwardResponseMessage + forward_Query_TotalSwappableToCoinAmount_0 = runtime.ForwardResponseMessage ) diff --git a/x/fswap/types/tx.pb.go b/x/fswap/types/tx.pb.go index 682ec7260b..2738e7aabb 100644 --- a/x/fswap/types/tx.pb.go +++ b/x/fswap/types/tx.pb.go @@ -32,7 +32,7 @@ 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 + // from-coin amount Amount types.Coin `protobuf:"bytes,2,opt,name=amount,proto3,castrepeated=github.com/Finschia/finschia-sdk/types.Coin" json:"amount"` }