From 5396d751fb0c24093528e27696128c2a704eb9f7 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Wed, 8 May 2024 21:43:39 +0900 Subject: [PATCH] feat(x/fswap): introduce new event(MakeSwapProposal) (#1363) (#1364) * feat(x/fswap): introduce new event(MakeSwapProposal) * chore: lint proto * chore: update proto-doc * chore: update changelog * chore: newline * chore: update proto * chore: make the event two separate events (cherry picked from commit 5e2cd7fe5ebe64fb042a40b7a1b106c6aa9f718e) Co-authored-by: jaeseung-bae <119839167+jaeseung-bae@users.noreply.github.com> --- CHANGELOG.md | 1 + docs/core/proto-docs.md | 104 ++++++--- proto/lbm/fswap/v1/event.proto | 11 + x/fswap/keeper/proposal.go | 8 +- x/fswap/keeper/proposal_test.go | 33 ++- x/fswap/types/event.pb.go | 392 ++++++++++++++++++++++++++++++-- 6 files changed, 490 insertions(+), 59 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a1e333a42..ce86103fb6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,6 +49,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Improvements * (types) [\#1314](https://github.com/Finschia/finschia-sdk/pull/1314) replace IsEqual with Equal +* (x/fswap) [\#1363](https://github.com/Finschia/finschia-sdk/pull/1363) introduce new event for MakeSwapProposal ### Bug Fixes * (x/auth) [#1281](https://github.com/Finschia/finschia-sdk/pull/1281) `ModuleAccount.Validate` now reports a nil `.BaseAccount` instead of panicking. (backport #1274) diff --git a/docs/core/proto-docs.md b/docs/core/proto-docs.md index b608648fca..07f82058d3 100644 --- a/docs/core/proto-docs.md +++ b/docs/core/proto-docs.md @@ -973,15 +973,17 @@ - [Msg](#lbm.foundation.v1.Msg) -- [lbm/fswap/v1/event.proto](#lbm/fswap/v1/event.proto) - - [EventSwapCoins](#lbm.fswap.v1.EventSwapCoins) - - [lbm/fswap/v1/fswap.proto](#lbm/fswap/v1/fswap.proto) - [MakeSwapProposal](#lbm.fswap.v1.MakeSwapProposal) - [Swap](#lbm.fswap.v1.Swap) - [SwapStats](#lbm.fswap.v1.SwapStats) - [Swapped](#lbm.fswap.v1.Swapped) +- [lbm/fswap/v1/event.proto](#lbm/fswap/v1/event.proto) + - [EventAddDenomMetadata](#lbm.fswap.v1.EventAddDenomMetadata) + - [EventMakeSwap](#lbm.fswap.v1.EventMakeSwap) + - [EventSwapCoins](#lbm.fswap.v1.EventSwapCoins) + - [lbm/fswap/v1/genesis.proto](#lbm/fswap/v1/genesis.proto) - [GenesisState](#lbm.fswap.v1.GenesisState) @@ -14481,39 +14483,6 @@ Msg defines the foundation Msg service. - -

Top

- -## lbm/fswap/v1/event.proto - - - - - -### EventSwapCoins - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `address` | [string](#string) | | holder's address | -| `from_coin_amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | from-coin amount | -| `to_coin_amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | to-coin amount | - - - - - - - - - - - - - - -

Top

@@ -14587,6 +14556,69 @@ From cosmos-sdk 0.46.0 they deprecated this way, but currently finschia-sdk base + + + + + + + + + + + +

Top

+ +## lbm/fswap/v1/event.proto + + + + + +### EventAddDenomMetadata + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `metadata` | [cosmos.bank.v1beta1.Metadata](#cosmos.bank.v1beta1.Metadata) | | | + + + + + + + + +### EventMakeSwap + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `swap` | [Swap](#lbm.fswap.v1.Swap) | | | + + + + + + + + +### EventSwapCoins + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `address` | [string](#string) | | holder's address | +| `from_coin_amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | from-coin amount | +| `to_coin_amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | to-coin amount | + + + + + diff --git a/proto/lbm/fswap/v1/event.proto b/proto/lbm/fswap/v1/event.proto index 6834da7654..10f9f3ea5d 100644 --- a/proto/lbm/fswap/v1/event.proto +++ b/proto/lbm/fswap/v1/event.proto @@ -5,6 +5,8 @@ option go_package = "github.com/Finschia/finschia-sdk/x/fswap/types"; import "gogoproto/gogo.proto"; import "cosmos/base/v1beta1/coin.proto"; +import "cosmos/bank/v1beta1/bank.proto"; +import "lbm/fswap/v1/fswap.proto"; message EventSwapCoins { // holder's address @@ -16,3 +18,12 @@ message EventSwapCoins { cosmos.base.v1beta1.Coin to_coin_amount = 3 [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/Finschia/finschia-sdk/types.Coin"]; } + +message EventMakeSwap { + Swap swap = 1 [(gogoproto.nullable) = false]; +} + +message EventAddDenomMetadata { + cosmos.bank.v1beta1.Metadata metadata = 1 + [(gogoproto.moretags) = "yaml:\"denom_metadata\"", (gogoproto.nullable) = false]; +} diff --git a/x/fswap/keeper/proposal.go b/x/fswap/keeper/proposal.go index e83829efd2..1893c9f33a 100644 --- a/x/fswap/keeper/proposal.go +++ b/x/fswap/keeper/proposal.go @@ -49,19 +49,25 @@ func (k Keeper) MakeSwap(ctx sdk.Context, swap types.Swap, toDenomMetadata bank. } } + eventManager := ctx.EventManager() if err := k.setSwap(ctx, swap); err != nil { return err } + if err := eventManager.EmitTypedEvent(&types.EventMakeSwap{Swap: swap}); err != nil { + panic(err) + } existingMetadata, ok := k.GetDenomMetaData(ctx, swap.ToDenom) if !ok { k.SetDenomMetaData(ctx, toDenomMetadata) + if err := eventManager.EmitTypedEvent(&(types.EventAddDenomMetadata{Metadata: toDenomMetadata})); err != nil { + panic(err) + } return nil } if !denomMetadataEqual(existingMetadata, toDenomMetadata) { return errors.ErrInvalidRequest.Wrap("changing existing metadata not allowed") } - return nil } diff --git a/x/fswap/keeper/proposal_test.go b/x/fswap/keeper/proposal_test.go index 4dbe0e63b2..65be82d923 100644 --- a/x/fswap/keeper/proposal_test.go +++ b/x/fswap/keeper/proposal_test.go @@ -1,6 +1,8 @@ package keeper_test import ( + abci "github.com/tendermint/tendermint/abci/types" + sdk "github.com/Finschia/finschia-sdk/types" sdkerrors "github.com/Finschia/finschia-sdk/types/errors" bank "github.com/Finschia/finschia-sdk/x/bank/types" @@ -13,6 +15,7 @@ func (s *KeeperTestSuite) TestMakeSwapProposal() { toDenomMeta bank.Metadata existingMetadata bool expectedError error + expectedEvents sdk.Events }{ "valid": { types.Swap{ @@ -24,6 +27,28 @@ func (s *KeeperTestSuite) TestMakeSwapProposal() { s.toDenomMetadata, false, nil, + sdk.Events{ + sdk.Event{ + Type: "lbm.fswap.v1.EventMakeSwap", + Attributes: []abci.EventAttribute{ + { + Key: []byte("swap"), + Value: []uint8{0x7b, 0x22, 0x66, 0x72, 0x6f, 0x6d, 0x5f, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x22, 0x3a, 0x22, 0x66, 0x72, 0x6f, 0x6d, 0x44, 0x22, 0x2c, 0x22, 0x74, 0x6f, 0x5f, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x22, 0x3a, 0x22, 0x74, 0x6f, 0x44, 0x22, 0x2c, 0x22, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x63, 0x61, 0x70, 0x5f, 0x66, 0x6f, 0x72, 0x5f, 0x74, 0x6f, 0x5f, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x22, 0x3a, 0x22, 0x31, 0x22, 0x2c, 0x22, 0x73, 0x77, 0x61, 0x70, 0x5f, 0x72, 0x61, 0x74, 0x65, 0x22, 0x3a, 0x22, 0x31, 0x2e, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x22, 0x7d}, + Index: false, + }, + }, + }, + sdk.Event{ + Type: "lbm.fswap.v1.EventAddDenomMetadata", + Attributes: []abci.EventAttribute{ + { + Key: []byte("metadata"), + Value: []uint8{0x7b, 0x22, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x3a, 0x22, 0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x74, 0x6f, 0x2d, 0x63, 0x6f, 0x69, 0x6e, 0x22, 0x2c, 0x22, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73, 0x22, 0x3a, 0x5b, 0x7b, 0x22, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x22, 0x3a, 0x22, 0x74, 0x6f, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x22, 0x2c, 0x22, 0x65, 0x78, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x65, 0x73, 0x22, 0x3a, 0x5b, 0x5d, 0x7d, 0x5d, 0x2c, 0x22, 0x62, 0x61, 0x73, 0x65, 0x22, 0x3a, 0x22, 0x64, 0x75, 0x6d, 0x6d, 0x79, 0x22, 0x2c, 0x22, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x22, 0x3a, 0x22, 0x64, 0x75, 0x6d, 0x6d, 0x79, 0x63, 0x6f, 0x69, 0x6e, 0x22, 0x2c, 0x22, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x3a, 0x22, 0x44, 0x55, 0x4d, 0x4d, 0x59, 0x22, 0x2c, 0x22, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x22, 0x3a, 0x22, 0x44, 0x55, 0x4d, 0x22, 0x7d}, + Index: false, + }, + }, + }, + }, }, "to-denom metadata change not allowed": { types.Swap{ @@ -42,6 +67,7 @@ func (s *KeeperTestSuite) TestMakeSwapProposal() { }, true, sdkerrors.ErrInvalidRequest, + sdk.Events{}, }, } for name, tc := range testCases { @@ -51,9 +77,12 @@ func (s *KeeperTestSuite) TestMakeSwapProposal() { if tc.existingMetadata { err := s.keeper.MakeSwap(ctx, tc.swap, s.toDenomMetadata) s.Require().ErrorIs(err, tc.expectedError) - } else { - s.Require().ErrorIs(err, tc.expectedError) + return } + + s.Require().ErrorIs(err, tc.expectedError) + events := ctx.EventManager().Events() + s.Require().Equal(tc.expectedEvents, events) }) } } diff --git a/x/fswap/types/event.pb.go b/x/fswap/types/event.pb.go index 6461787a83..a535059e7e 100644 --- a/x/fswap/types/event.pb.go +++ b/x/fswap/types/event.pb.go @@ -6,6 +6,7 @@ package types import ( fmt "fmt" types "github.com/Finschia/finschia-sdk/types" + types1 "github.com/Finschia/finschia-sdk/x/bank/types" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" io "io" @@ -87,33 +88,130 @@ func (m *EventSwapCoins) GetToCoinAmount() types.Coin { return types.Coin{} } +type EventMakeSwap struct { + Swap Swap `protobuf:"bytes,1,opt,name=swap,proto3" json:"swap"` +} + +func (m *EventMakeSwap) Reset() { *m = EventMakeSwap{} } +func (m *EventMakeSwap) String() string { return proto.CompactTextString(m) } +func (*EventMakeSwap) ProtoMessage() {} +func (*EventMakeSwap) Descriptor() ([]byte, []int) { + return fileDescriptor_92d5edbd64a725af, []int{1} +} +func (m *EventMakeSwap) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventMakeSwap) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventMakeSwap.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *EventMakeSwap) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventMakeSwap.Merge(m, src) +} +func (m *EventMakeSwap) XXX_Size() int { + return m.Size() +} +func (m *EventMakeSwap) XXX_DiscardUnknown() { + xxx_messageInfo_EventMakeSwap.DiscardUnknown(m) +} + +var xxx_messageInfo_EventMakeSwap proto.InternalMessageInfo + +func (m *EventMakeSwap) GetSwap() Swap { + if m != nil { + return m.Swap + } + return Swap{} +} + +type EventAddDenomMetadata struct { + Metadata types1.Metadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata" yaml:"denom_metadata"` +} + +func (m *EventAddDenomMetadata) Reset() { *m = EventAddDenomMetadata{} } +func (m *EventAddDenomMetadata) String() string { return proto.CompactTextString(m) } +func (*EventAddDenomMetadata) ProtoMessage() {} +func (*EventAddDenomMetadata) Descriptor() ([]byte, []int) { + return fileDescriptor_92d5edbd64a725af, []int{2} +} +func (m *EventAddDenomMetadata) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventAddDenomMetadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventAddDenomMetadata.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *EventAddDenomMetadata) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventAddDenomMetadata.Merge(m, src) +} +func (m *EventAddDenomMetadata) XXX_Size() int { + return m.Size() +} +func (m *EventAddDenomMetadata) XXX_DiscardUnknown() { + xxx_messageInfo_EventAddDenomMetadata.DiscardUnknown(m) +} + +var xxx_messageInfo_EventAddDenomMetadata proto.InternalMessageInfo + +func (m *EventAddDenomMetadata) GetMetadata() types1.Metadata { + if m != nil { + return m.Metadata + } + return types1.Metadata{} +} + func init() { proto.RegisterType((*EventSwapCoins)(nil), "lbm.fswap.v1.EventSwapCoins") + proto.RegisterType((*EventMakeSwap)(nil), "lbm.fswap.v1.EventMakeSwap") + proto.RegisterType((*EventAddDenomMetadata)(nil), "lbm.fswap.v1.EventAddDenomMetadata") } func init() { proto.RegisterFile("lbm/fswap/v1/event.proto", fileDescriptor_92d5edbd64a725af) } var fileDescriptor_92d5edbd64a725af = []byte{ - // 289 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x91, 0xc1, 0x4a, 0xc3, 0x30, - 0x1c, 0xc6, 0x9b, 0x09, 0x8a, 0x75, 0x14, 0x29, 0x1e, 0xea, 0x0e, 0xd9, 0xf0, 0x34, 0x10, 0x13, - 0xea, 0x9e, 0xc0, 0x89, 0xe2, 0x79, 0xde, 0xbc, 0x8c, 0xa4, 0x4d, 0xbb, 0xe2, 0xd2, 0x7f, 0x69, - 0xb2, 0x6e, 0xbe, 0x85, 0x67, 0x1f, 0xc1, 0x27, 0xd9, 0x71, 0x47, 0x4f, 0x2a, 0xed, 0x8b, 0x48, - 0xd2, 0x8a, 0x78, 0xf2, 0xe4, 0xed, 0x0b, 0x5f, 0xbe, 0xdf, 0x0f, 0x12, 0x37, 0x58, 0x72, 0x49, - 0x13, 0xb5, 0x66, 0x05, 0xad, 0x42, 0x2a, 0x2a, 0x91, 0x6b, 0x52, 0x94, 0xa0, 0xc1, 0xef, 0x2f, - 0xb9, 0x24, 0xb6, 0x21, 0x55, 0x38, 0x38, 0x49, 0x21, 0x05, 0x5b, 0x50, 0x93, 0xda, 0x3b, 0x03, - 0x1c, 0x81, 0x92, 0xa0, 0x28, 0x67, 0x4a, 0xd0, 0x2a, 0xe4, 0x42, 0xb3, 0x90, 0x46, 0x90, 0xe5, - 0x6d, 0x7f, 0xf6, 0xd2, 0x73, 0xbd, 0x1b, 0xc3, 0xbc, 0x5f, 0xb3, 0xe2, 0x1a, 0xb2, 0x5c, 0xf9, - 0x81, 0x7b, 0xc0, 0xe2, 0xb8, 0x14, 0x4a, 0x05, 0x68, 0x84, 0xc6, 0x87, 0xb3, 0xef, 0xa3, 0xbf, - 0x71, 0x8f, 0x93, 0x12, 0xe4, 0xdc, 0xec, 0xe7, 0x4c, 0xc2, 0x2a, 0xd7, 0x41, 0x6f, 0x84, 0xc6, - 0x47, 0x97, 0xa7, 0xa4, 0xf5, 0x10, 0xe3, 0x21, 0x9d, 0x87, 0x18, 0xde, 0x74, 0xb2, 0x7d, 0x1f, - 0x3a, 0xaf, 0x1f, 0xc3, 0xf3, 0x34, 0xd3, 0x8b, 0x15, 0x27, 0x11, 0x48, 0x7a, 0x9b, 0xe5, 0x2a, - 0x5a, 0x64, 0x8c, 0x26, 0x5d, 0xb8, 0x50, 0xf1, 0x23, 0xd5, 0x4f, 0x85, 0x50, 0x76, 0x34, 0xf3, - 0x8c, 0xc7, 0xa4, 0x2b, 0x6b, 0xf1, 0xb5, 0xeb, 0x69, 0xf8, 0xe5, 0xdd, 0xfb, 0x17, 0x6f, 0x5f, - 0xc3, 0x8f, 0x75, 0x7a, 0xb7, 0xad, 0x31, 0xda, 0xd5, 0x18, 0x7d, 0xd6, 0x18, 0x3d, 0x37, 0xd8, - 0xd9, 0x35, 0xd8, 0x79, 0x6b, 0xb0, 0xf3, 0x40, 0xfe, 0x84, 0x6e, 0xba, 0x3f, 0xb3, 0x70, 0xbe, - 0x6f, 0x5f, 0x7b, 0xf2, 0x15, 0x00, 0x00, 0xff, 0xff, 0xe2, 0xc5, 0x6e, 0x30, 0xcd, 0x01, 0x00, - 0x00, + // 403 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x92, 0xcd, 0x8e, 0xda, 0x30, + 0x14, 0x85, 0x13, 0x8a, 0xfa, 0x63, 0x28, 0xaa, 0xa2, 0x22, 0xa5, 0x48, 0x04, 0x94, 0x15, 0x52, + 0x5b, 0x5b, 0x81, 0x5d, 0xa5, 0x2e, 0x48, 0x7f, 0xd4, 0x0d, 0x9b, 0x74, 0x53, 0x75, 0x83, 0x9c, + 0xc4, 0x40, 0x14, 0x6c, 0xa7, 0xd8, 0x04, 0x78, 0x8b, 0xae, 0xfb, 0x08, 0x7d, 0x12, 0x96, 0x2c, + 0x67, 0xc5, 0x8c, 0xe0, 0x0d, 0xe6, 0x09, 0x46, 0x36, 0x01, 0x06, 0xcd, 0x62, 0x56, 0xb3, 0xbb, + 0xd6, 0xb9, 0xf7, 0x7c, 0xd7, 0xc7, 0x06, 0xf6, 0x34, 0xa4, 0x68, 0x24, 0x16, 0x38, 0x43, 0xb9, + 0x87, 0x48, 0x4e, 0x98, 0x84, 0xd9, 0x8c, 0x4b, 0x6e, 0x55, 0xa7, 0x21, 0x85, 0x5a, 0x81, 0xb9, + 0xd7, 0x78, 0x3b, 0xe6, 0x63, 0xae, 0x05, 0xa4, 0xaa, 0x43, 0x4f, 0xc3, 0x89, 0xb8, 0xa0, 0x5c, + 0xa0, 0x10, 0x0b, 0x82, 0x72, 0x2f, 0x24, 0x12, 0x7b, 0x28, 0xe2, 0x09, 0x7b, 0xa0, 0xb3, 0xf4, + 0xa4, 0xab, 0x43, 0xa1, 0x5f, 0xd2, 0x0f, 0x30, 0xad, 0xb8, 0xff, 0x4a, 0xa0, 0xf6, 0x4d, 0x6d, + 0xf3, 0x73, 0x81, 0xb3, 0x2f, 0x3c, 0x61, 0xc2, 0xb2, 0xc1, 0x0b, 0x1c, 0xc7, 0x33, 0x22, 0x84, + 0x6d, 0xb6, 0xcd, 0xce, 0xab, 0xe0, 0x78, 0xb4, 0x96, 0xe0, 0xcd, 0x68, 0xc6, 0xe9, 0x50, 0x91, + 0x87, 0x98, 0xf2, 0x39, 0x93, 0x76, 0xa9, 0x6d, 0x76, 0x2a, 0xdd, 0x77, 0xf0, 0xb0, 0x01, 0x54, + 0x1b, 0xc2, 0x62, 0x03, 0xa8, 0xfc, 0xfc, 0xde, 0x7a, 0xdb, 0x32, 0xfe, 0x5f, 0xb7, 0xde, 0x8f, + 0x13, 0x39, 0x99, 0x87, 0x30, 0xe2, 0x14, 0x7d, 0x4f, 0x98, 0x88, 0x26, 0x09, 0x46, 0xa3, 0xa2, + 0xf8, 0x28, 0xe2, 0x14, 0xc9, 0x55, 0x46, 0x84, 0x1e, 0x0a, 0x6a, 0x8a, 0xa3, 0xaa, 0xbe, 0xa6, + 0x58, 0x12, 0xd4, 0x24, 0xbf, 0xe0, 0x3e, 0x7b, 0x12, 0x6e, 0x55, 0xf2, 0x33, 0xd5, 0xfd, 0x0c, + 0x5e, 0xeb, 0x6c, 0x06, 0x38, 0x25, 0x2a, 0x1f, 0xeb, 0x03, 0x28, 0xab, 0xec, 0x74, 0x2e, 0x95, + 0xae, 0x05, 0xef, 0x3f, 0x1d, 0x54, 0x1d, 0x7e, 0x59, 0x51, 0x03, 0xdd, 0xe5, 0xfe, 0x01, 0x75, + 0x3d, 0xde, 0x8f, 0xe3, 0xaf, 0x84, 0x71, 0x3a, 0x20, 0x12, 0xc7, 0x58, 0x62, 0xeb, 0x17, 0x78, + 0x49, 0x8b, 0xba, 0xb0, 0x6a, 0x9e, 0xef, 0xc1, 0xd2, 0xd3, 0x3d, 0x8e, 0x03, 0x7e, 0x53, 0xb9, + 0xde, 0x6e, 0x5b, 0xf5, 0x15, 0xa6, 0xd3, 0x4f, 0x6e, 0xac, 0xdc, 0x86, 0x47, 0x0b, 0x37, 0x38, + 0xb9, 0xf9, 0x3f, 0xd6, 0x3b, 0xc7, 0xdc, 0xec, 0x1c, 0xf3, 0x66, 0xe7, 0x98, 0x7f, 0xf7, 0x8e, + 0xb1, 0xd9, 0x3b, 0xc6, 0xd5, 0xde, 0x31, 0x7e, 0xc3, 0x47, 0x63, 0x58, 0x16, 0x3f, 0x44, 0xc7, + 0x11, 0x3e, 0xd7, 0xff, 0xa3, 0x77, 0x17, 0x00, 0x00, 0xff, 0xff, 0x9f, 0x45, 0x65, 0x5a, 0xb9, + 0x02, 0x00, 0x00, } func (m *EventSwapCoins) Marshal() (dAtA []byte, err error) { @@ -166,6 +264,72 @@ func (m *EventSwapCoins) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *EventMakeSwap) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EventMakeSwap) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventMakeSwap) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Swap.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintEvent(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *EventAddDenomMetadata) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EventAddDenomMetadata) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventAddDenomMetadata) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Metadata.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintEvent(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + func encodeVarintEvent(dAtA []byte, offset int, v uint64) int { offset -= sovEvent(v) base := offset @@ -194,6 +358,28 @@ func (m *EventSwapCoins) Size() (n int) { return n } +func (m *EventMakeSwap) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Swap.Size() + n += 1 + l + sovEvent(uint64(l)) + return n +} + +func (m *EventAddDenomMetadata) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Metadata.Size() + n += 1 + l + sovEvent(uint64(l)) + return n +} + func sovEvent(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -348,6 +534,172 @@ func (m *EventSwapCoins) Unmarshal(dAtA []byte) error { } return nil } +func (m *EventMakeSwap) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EventMakeSwap: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventMakeSwap: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Swap", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEvent + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Swap.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvent(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvent + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EventAddDenomMetadata) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EventAddDenomMetadata: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventAddDenomMetadata: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEvent + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Metadata.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvent(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvent + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipEvent(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0