diff --git a/docs/core/proto-docs.md b/docs/core/proto-docs.md index 833f112287..16831e12a1 100644 --- a/docs/core/proto-docs.md +++ b/docs/core/proto-docs.md @@ -876,9 +876,9 @@ - [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) @@ -12914,7 +12914,7 @@ 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 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| +| `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| @@ -12927,41 +12927,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 | -| `from_coin_amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | from-coin amount | @@ -12991,8 +12994,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/query.proto b/proto/lbm/fswap/v1/query.proto index 09ca077261..3502013229 100644 --- a/proto/lbm/fswap/v1/query.proto +++ b/proto/lbm/fswap/v1/query.proto @@ -17,7 +17,7 @@ service Query { // 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"; + option (google.api.http).get = "/lbm/fswap/v1/total_swappable_to_coin_amount"; } } diff --git a/proto/lbm/fswap/v1/tx.proto b/proto/lbm/fswap/v1/tx.proto index 004819fa46..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; // 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/x/fswap/client/cli/tx.go b/x/fswap/client/cli/tx.go index 047071181c..0ab9c915ec 100644 --- a/x/fswap/client/cli/tx.go +++ b/x/fswap/client/cli/tx.go @@ -60,7 +60,7 @@ func CmdTxMsgSwap() *cobra.Command { return err } - msg := &types.MsgSwapRequest{ + msg := &types.MsgSwap{ FromAddress: clientCtx.GetFromAddress().String(), FromCoinAmount: coin, } @@ -89,7 +89,7 @@ func CmdTxMsgSwapAll() *cobra.Command { return err } - msg := &types.MsgSwapAllRequest{ + msg := &types.MsgSwapAll{ FromAddress: clientCtx.GetFromAddress().String(), } if err := msg.ValidateBasic(); err != nil { diff --git a/x/fswap/keeper/keeper.go b/x/fswap/keeper/keeper.go index 2634a68b1b..450a43ce21 100644 --- a/x/fswap/keeper/keeper.go +++ b/x/fswap/keeper/keeper.go @@ -71,18 +71,22 @@ func (k Keeper) SwapInit(ctx sdk.Context, swapInit types.SwapInit) error { return nil } -func (k Keeper) Swap(ctx sdk.Context, addr sdk.AccAddress, fromCoinAmount sdk.Coin) error { +func (k Keeper) Swap(ctx sdk.Context, addr sdk.AccAddress, fromCoinAmount sdk.Coin, toDenom string) error { swapInit, err := k.getSwapInit(ctx) if err != nil { return err } - if fromCoinAmount.GetDenom() != swapInit.GetFromDenom() { + if swapInit.GetFromDenom() != fromCoinAmount.GetDenom() { return sdkerrors.ErrInvalidRequest.Wrapf("denom mismatch, expected %s, got %s", swapInit.GetFromDenom(), fromCoinAmount.Denom) } + if swapInit.GetToDenom() != toDenom { + return sdkerrors.ErrInvalidRequest.Wrapf("denom mismatch, expected %s, got %s", swapInit.GetToDenom(), toDenom) + } + newAmount := fromCoinAmount.Amount.Mul(swapInit.SwapMultiple) - newCoinAmount := sdk.NewCoin(swapInit.ToDenom, newAmount) + newCoinAmount := sdk.NewCoin(toDenom, newAmount) if err := k.checkSwapCap(ctx, newCoinAmount); err != nil { return err } @@ -117,17 +121,13 @@ func (k Keeper) Swap(ctx sdk.Context, addr sdk.AccAddress, fromCoinAmount sdk.Co return nil } -func (k Keeper) SwapAll(ctx sdk.Context, addr sdk.AccAddress) error { - oldDenom, err := k.getFromDenom(ctx) - if err != nil { - return err - } - balance := k.GetBalance(ctx, addr, oldDenom) +func (k Keeper) SwapAll(ctx sdk.Context, addr sdk.AccAddress, fromDenom, toDenom string) error { + balance := k.GetBalance(ctx, addr, fromDenom) if balance.IsZero() { return sdkerrors.ErrInsufficientFunds } - if err := k.Swap(ctx, addr, balance); err != nil { + if err := k.Swap(ctx, addr, balance, toDenom); err != nil { return err } return nil @@ -144,7 +144,7 @@ func (k Keeper) setSwapInit(ctx sdk.Context, swapInit types.SwapInit) error { } func (k Keeper) getAllSwapped(ctx sdk.Context) []types.Swapped { - swappedSlice := make([]types.Swapped, 0) + swappedSlice := make([]types.Swapped, 0) // TODO(bjs) k.iterateAllSwapped(ctx, func(swapped types.Swapped) bool { swappedSlice = append(swappedSlice, swapped) return false diff --git a/x/fswap/keeper/keeper_test.go b/x/fswap/keeper/keeper_test.go index f0cb62a5fe..a49b42317c 100644 --- a/x/fswap/keeper/keeper_test.go +++ b/x/fswap/keeper/keeper_test.go @@ -108,6 +108,7 @@ func (s *KeeperTestSuite) TestSwap() { testCases := map[string]struct { from sdk.AccAddress amountToSwap sdk.Coin + toDenom string expectedBalanceWithoutMultiply sdk.Int shouldThrowError bool expectedError error @@ -115,6 +116,7 @@ func (s *KeeperTestSuite) TestSwap() { "swap some": { s.accWithFromCoin, sdk.NewCoin(s.fromDenom, sdk.NewInt(100)), + s.toDenom, sdk.NewInt(100), false, nil, @@ -122,6 +124,7 @@ func (s *KeeperTestSuite) TestSwap() { "swap all the balance": { s.accWithFromCoin, sdk.NewCoin(s.fromDenom, s.initBalance), + s.toDenom, s.initBalance, false, nil, @@ -129,6 +132,7 @@ func (s *KeeperTestSuite) TestSwap() { "swap without holding enough balance": { s.accWithFromCoin, sdk.NewCoin(s.fromDenom, sdk.OneInt().Add(s.initBalance)), + s.toDenom, sdk.ZeroInt(), true, sdkerrors.ErrInsufficientFunds, @@ -136,6 +140,7 @@ func (s *KeeperTestSuite) TestSwap() { "account holding new coin only": { s.accWithToCoin, sdk.NewCoin(s.fromDenom, sdk.NewInt(100)), + s.toDenom, sdk.ZeroInt(), true, sdkerrors.ErrInsufficientFunds, @@ -143,6 +148,7 @@ func (s *KeeperTestSuite) TestSwap() { "swap with the same from-denom and to-denom": { s.accWithFromCoin, sdk.NewCoin(s.toDenom, s.initBalance), + s.toDenom, sdk.ZeroInt(), true, sdkerrors.ErrInvalidRequest, @@ -154,7 +160,7 @@ func (s *KeeperTestSuite) TestSwap() { err := s.keeper.SwapInit(ctx, s.swapInit) s.Require().NoError(err) - err = s.keeper.Swap(ctx, tc.from, tc.amountToSwap) + err = s.keeper.Swap(ctx, tc.from, tc.amountToSwap, tc.toDenom) if tc.shouldThrowError { s.Require().ErrorIs(err, tc.expectedError) return @@ -171,18 +177,24 @@ func (s *KeeperTestSuite) TestSwap() { func (s *KeeperTestSuite) TestSwapAll() { testCases := map[string]struct { from sdk.AccAddress + fromDenom string + toDenom string expectedBalanceWithoutMultiply sdk.Int shouldThrowError bool expectedError error }{ "account holding from coin": { s.accWithFromCoin, + s.fromDenom, + s.toDenom, s.initBalance, false, nil, }, "account holding to coin only": { s.accWithToCoin, + s.fromDenom, + s.toDenom, s.initBalance, true, sdkerrors.ErrInsufficientFunds, @@ -194,7 +206,7 @@ func (s *KeeperTestSuite) TestSwapAll() { err := s.keeper.SwapInit(ctx, s.swapInit) s.Require().NoError(err) - err = s.keeper.SwapAll(ctx, tc.from) + err = s.keeper.SwapAll(ctx, tc.from, tc.fromDenom, tc.toDenom) if tc.shouldThrowError { s.Require().ErrorIs(err, tc.expectedError) return diff --git a/x/fswap/keeper/msg_server.go b/x/fswap/keeper/msg_server.go index f1892a2575..b9484492e3 100644 --- a/x/fswap/keeper/msg_server.go +++ b/x/fswap/keeper/msg_server.go @@ -4,7 +4,6 @@ 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" ) @@ -18,43 +17,30 @@ func NewMsgServer(keeper Keeper) *MsgServer { return &MsgServer{keeper} } -func (s MsgServer) Swap(ctx context.Context, req *types.MsgSwapRequest) (*types.MsgSwapResponse, error) { +func (s MsgServer) Swap(ctx context.Context, req *types.MsgSwap) (*types.MsgSwapResponse, error) { c := sdk.UnwrapSDKContext(ctx) - swapInit, err := s.keeper.getSwapInit(c) - if err != nil { - return &types.MsgSwapResponse{}, err - } - - if req.GetFromCoinAmount().Denom != swapInit.GetFromDenom() { - return nil, sdkerrors.ErrInvalidCoins - } - from, err := sdk.AccAddressFromBech32(req.FromAddress) if err != nil { return nil, err } - if err := s.keeper.Swap(c, from, req.GetFromCoinAmount()); err != nil { + if err := s.keeper.Swap(c, from, req.GetFromCoinAmount(), req.GetToDenom()); err != nil { return nil, err } return &types.MsgSwapResponse{}, nil } -func (s MsgServer) SwapAll(ctx context.Context, req *types.MsgSwapAllRequest) (*types.MsgSwapAllResponse, error) { +func (s MsgServer) SwapAll(ctx context.Context, req *types.MsgSwapAll) (*types.MsgSwapAllResponse, error) { c := sdk.UnwrapSDKContext(ctx) - if !s.keeper.hasBeenInitialized(c) { - return &types.MsgSwapAllResponse{}, types.ErrSwapNotInitialized - } - from, err := sdk.AccAddressFromBech32(req.FromAddress) if err != nil { return nil, err } - if err := s.keeper.SwapAll(c, from); err != nil { + if err := s.keeper.SwapAll(c, from, req.GetFromDenom(), req.GetToDenom()); err != nil { return nil, err } diff --git a/x/fswap/keeper/msg_server_test.go b/x/fswap/keeper/msg_server_test.go index 9429264902..8dde4f9b4b 100644 --- a/x/fswap/keeper/msg_server_test.go +++ b/x/fswap/keeper/msg_server_test.go @@ -1 +1,119 @@ 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() { + testCases := map[string]struct { + request *types.MsgSwap + expectedBalanceWithoutMultiply sdk.Int + shouldThrowError bool + expectedError error + }{ + "swap some": { + &types.MsgSwap{ + FromAddress: s.accWithFromCoin.String(), + FromCoinAmount: sdk.NewCoin(s.fromDenom, sdk.NewInt(100)), + ToDenom: s.toDenom, + }, + sdk.NewInt(100), + false, + nil, + }, + "swap all the balance": { + &types.MsgSwap{ + FromAddress: s.accWithFromCoin.String(), + FromCoinAmount: sdk.NewCoin(s.fromDenom, s.initBalance), + ToDenom: s.toDenom, + }, + s.initBalance, + false, + nil, + }, + "account holding new coin only": { + &types.MsgSwap{ + FromAddress: s.accWithToCoin.String(), + FromCoinAmount: sdk.NewCoin(s.fromDenom, sdk.NewInt(100)), + ToDenom: s.toDenom, + }, + s.initBalance, + true, + sdkerrors.ErrInsufficientFunds, + }, + } + for name, tc := range testCases { + s.Run(name, func() { + ctx, _ := s.ctx.CacheContext() + err := s.keeper.SwapInit(ctx, s.swapInit) + 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 + expectedAmount := tc.expectedBalanceWithoutMultiply.Mul(s.swapMultiple) + s.Require().Equal(expectedAmount, actualAmount) + }) + } +} + +func (s *KeeperTestSuite) TestMsgSwapAll() { + testCases := map[string]struct { + request *types.MsgSwapAll + expectedBalanceWithoutMultiply sdk.Int + shouldThrowError bool + expectedError error + }{ + "swapAll": { + &types.MsgSwapAll{ + FromAddress: s.accWithFromCoin.String(), + FromDenom: s.fromDenom, + ToDenom: s.toDenom, + }, + s.initBalance, + false, + nil, + }, + "account holding new coin only": { + &types.MsgSwapAll{ + FromAddress: s.accWithToCoin.String(), + FromDenom: s.fromDenom, + ToDenom: s.toDenom, + }, + s.initBalance, + true, + sdkerrors.ErrInsufficientFunds, + }, + } + for name, tc := range testCases { + s.Run(name, func() { + ctx, _ := s.ctx.CacheContext() + err := s.keeper.SwapInit(ctx, s.swapInit) + 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 + expectedAmount := tc.expectedBalanceWithoutMultiply.Mul(s.swapMultiple) + s.Require().Equal(expectedAmount, actualAmount) + }) + } +} diff --git a/x/fswap/types/msgs.go b/x/fswap/types/msgs.go index 996bb7425a..2d74d9a6e7 100644 --- a/x/fswap/types/msgs.go +++ b/x/fswap/types/msgs.go @@ -5,10 +5,10 @@ import ( sdkerrors "github.com/Finschia/finschia-sdk/types/errors" ) -var _ sdk.Msg = &MsgSwapRequest{} +var _ sdk.Msg = &MsgSwap{} // ValidateBasic Implements Msg. -func (m *MsgSwapRequest) ValidateBasic() error { +func (m *MsgSwap) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(m.FromAddress) if err != nil { return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid address (%s)", err) @@ -22,11 +22,15 @@ func (m *MsgSwapRequest) ValidateBasic() error { return sdkerrors.Wrap(sdkerrors.ErrInvalidCoins, m.FromCoinAmount.String()) } + if len(m.GetToDenom()) == 0 { + return sdkerrors.Wrap(sdkerrors.ErrInvalidCoins, m.FromCoinAmount.String()) + } + return nil } // GetSigners Implements Msg. -func (m *MsgSwapRequest) GetSigners() []sdk.AccAddress { +func (m *MsgSwap) GetSigners() []sdk.AccAddress { from, err := sdk.AccAddressFromBech32(m.FromAddress) if err != nil { panic(err) @@ -34,27 +38,28 @@ func (m *MsgSwapRequest) GetSigners() []sdk.AccAddress { 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()} -} +var _ sdk.Msg = &MsgSwapAll{} // ValidateBasic Implements Msg. -func (m *MsgSwapAllRequest) ValidateBasic() error { +func (m *MsgSwapAll) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(m.FromAddress) if err != nil { return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid address (%s)", err) } + if len(m.GetFromDenom()) == 0 { + return sdkerrors.Wrap(sdkerrors.ErrInvalidCoins, "Invalid Denom") + } + + if len(m.GetToDenom()) == 0 { + return sdkerrors.Wrap(sdkerrors.ErrInvalidCoins, "Invalid Denom") + } + return nil } // GetSigners Implements Msg. -func (m *MsgSwapAllRequest) GetSigners() []sdk.AccAddress { +func (m *MsgSwapAll) GetSigners() []sdk.AccAddress { from, err := sdk.AccAddressFromBech32(m.FromAddress) if err != nil { panic(err) diff --git a/x/fswap/types/query.pb.go b/x/fswap/types/query.pb.go index 3478a1db06..4a13541bf4 100644 --- a/x/fswap/types/query.pb.go +++ b/x/fswap/types/query.pb.go @@ -212,35 +212,35 @@ func init() { func init() { proto.RegisterFile("lbm/fswap/v1/query.proto", fileDescriptor_01deae9da7816d6a) } var fileDescriptor_01deae9da7816d6a = []byte{ - // 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, 0x51, 0x83, - 0x22, 0x24, 0x11, 0x64, 0xf4, 0x59, 0x22, 0x64, 0x34, 0x48, 0x18, 0xed, 0x9b, 0xe2, 0xa1, 0xec, - 0xbd, 0xa6, 0x6a, 0x96, 0x73, 0xa9, 0x2f, 0xb5, 0x0f, 0x4b, 0x4e, 0x59, 0x3d, 0xd1, 0x14, 0xac, - 0xd0, 0xa1, 0x82, 0x1a, 0xd7, 0xd9, 0x0b, 0xf7, 0x40, 0xc1, 0x1f, 0xaa, 0x7f, 0x81, 0xee, 0xe9, - 0x1c, 0x3a, 0xa0, 0x58, 0xaa, 0xc3, 0x60, 0x61, 0xca, 0x3b, 0x1b, 0x92, 0x75, 0x64, 0x1f, 0x6c, - 0x74, 0xbe, 0x53, 0x6a, 0x52, 0x9c, 0xa1, 0x23, 0xb9, 0x16, 0xec, 0x37, 0xc5, 0x6b, 0xbf, 0x39, - 0x95, 0x85, 0xc6, 0x27, 0x07, 0x5d, 0xd2, 0x36, 0x31, 0xa0, 0x2b, 0x66, 0xba, 0xf8, 0x2e, 0xd9, - 0x5c, 0x41, 0xb2, 0x65, 0x23, 0x5c, 0xff, 0x5f, 0x92, 0xea, 0xb7, 0xfc, 0xdb, 0x6f, 0xbe, 0xfc, - 0x7c, 0xef, 0xdc, 0xc0, 0x27, 0xb4, 0xb6, 0x6f, 0xd2, 0x50, 0x3e, 0xdb, 0xc8, 0xfd, 0x7b, 0x38, - 0xf8, 0xd1, 0x16, 0xc2, 0xce, 0xd8, 0xdd, 0xc7, 0xff, 0x79, 0xcb, 0x58, 0xa5, 0xda, 0xea, 0x7d, - 0x7c, 0xbe, 0xc5, 0xaa, 0x9e, 0x8a, 0xe0, 0x93, 0xcd, 0x65, 0x6b, 0x3d, 0x9f, 0x2f, 0x3d, 0x7b, - 0xb1, 0xf4, 0xec, 0x1f, 0x4b, 0xcf, 0x7e, 0xb7, 0xf2, 0xac, 0xc5, 0xca, 0xb3, 0xbe, 0xae, 0x3c, - 0xeb, 0x15, 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, + // 446 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x93, 0xbf, 0x8e, 0xd3, 0x40, + 0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d5, 0x0b, 0x6d, 0x95, + 0xe0, 0xc7, 0x75, 0xab, 0xaa, 0x9c, 0x6c, 0xaf, 0x76, 0x53, 0xbf, 0xb8, 0xc6, 0xcb, 0xe9, 0xdc, + 0xb3, 0x67, 0x73, 0xcf, 0xfe, 0x35, 0xf7, 0xec, 0x0f, 0x0b, 0xcf, 0x9a, 0x2d, 0x3c, 0xeb, 0xfb, + 0xc2, 0xb3, 0xde, 0x90, 0xad, 0x4b, 0x19, 0x1b, 0x8a, 0x5e, 0x4e, 0x78, 0x55, 0x7f, 0x7e, 0xe7, + 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0xc0, 0xa3, 0xd5, 0x06, 0x16, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/x/fswap/types/query.pb.gw.go b/x/fswap/types/query.pb.gw.go index b657b521fd..ea06d0652c 100644 --- a/x/fswap/types/query.pb.gw.go +++ b/x/fswap/types/query.pb.gw.go @@ -200,7 +200,7 @@ 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_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))) + 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))) ) var ( diff --git a/x/fswap/types/tx.pb.go b/x/fswap/types/tx.pb.go index 0a0cb720e0..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"` // 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) GetFromCoinAmount() types.Coin { +func (m *MsgSwap) GetFromCoinAmount() types.Coin { if m != nil { return m.FromCoinAmount } return types.Coin{} } +func (m *MsgSwap) GetToDenom() string { + if m != nil { + return m.ToDenom + } + return "" +} + type MsgSwapResponse struct { } @@ -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,39 +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{ - // 359 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x52, 0xcd, 0x4e, 0xf2, 0x40, - 0x14, 0xed, 0x7c, 0x9f, 0xd1, 0x38, 0x10, 0x94, 0x09, 0x26, 0xd8, 0x68, 0xc1, 0xae, 0x48, 0x8c, - 0x33, 0x29, 0x24, 0xee, 0x81, 0xc4, 0xb8, 0x90, 0x0d, 0xee, 0xdc, 0x90, 0xb6, 0x94, 0xd2, 0xd8, - 0x76, 0x2a, 0xb7, 0xfc, 0xf8, 0x16, 0x2e, 0x7d, 0x06, 0x13, 0xdf, 0x83, 0x25, 0x4b, 0x57, 0x6a, - 0xe0, 0x45, 0xcc, 0xcc, 0x34, 0x8a, 0x89, 0x44, 0x77, 0x37, 0xe7, 0x9c, 0x7b, 0xce, 0xed, 0xe9, - 0xe0, 0x83, 0xd0, 0x89, 0xd8, 0x00, 0xa6, 0x76, 0xc2, 0x26, 0x16, 0x4b, 0x67, 0x34, 0x19, 0xf1, - 0x94, 0x93, 0x7c, 0xe8, 0x44, 0x54, 0xc2, 0x74, 0x62, 0xe9, 0x25, 0x9f, 0xfb, 0x5c, 0x12, 0x4c, - 0x4c, 0x4a, 0xa3, 0x1b, 0x2e, 0x87, 0x88, 0x03, 0x73, 0x6c, 0xf0, 0xd8, 0x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75, 0xb3, 0x40, 0xb9, 0xb5, 0x2e, 0xe7, 0x4b, 0x03, 0x2d, 0x96, 0x06, 0x7a, 0x5f, 0x1a, - 0xe8, 0x61, 0x65, 0x68, 0x8b, 0x95, 0xa1, 0xbd, 0xac, 0x0c, 0xed, 0x86, 0xfe, 0x5a, 0xe9, 0x2c, - 0x7b, 0x3f, 0xb2, 0x5a, 0x67, 0x5b, 0xfe, 0xfc, 0xc6, 0x47, 0x00, 0x00, 0x00, 0xff, 0xff, 0x65, - 0xac, 0x90, 0x75, 0x59, 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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 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. @@ -248,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 { @@ -260,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 { @@ -269,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 { @@ -280,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") } @@ -300,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 } @@ -312,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 } @@ -330,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) } @@ -352,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]) @@ -362,16 +388,23 @@ 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.FromCoinAmount.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -415,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]) @@ -425,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) @@ -479,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 } @@ -491,6 +538,10 @@ func (m *MsgSwapRequest) Size() (n int) { } 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 } @@ -503,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 } @@ -513,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 } @@ -531,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 { @@ -554,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: @@ -625,6 +684,38 @@ func (m *MsgSwapRequest) Unmarshal(dAtA []byte) error { 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:]) @@ -696,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 { @@ -719,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: @@ -757,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:])