From b4726b1d720fb62fa3f3787c13af5cd24da16ac5 Mon Sep 17 00:00:00 2001 From: orngefrost Date: Mon, 19 Oct 2020 13:23:33 +0900 Subject: [PATCH 1/3] feat: add single-token deposit message --- proto/osmosis/gamm/v1beta1/pool.proto | 1 - proto/osmosis/gamm/v1beta1/tx.proto | 98 +- x/gamm/types/pool.pb.go | 72 +- x/gamm/types/tx.pb.go | 2400 ++++++++++++++++++++----- 4 files changed, 2049 insertions(+), 522 deletions(-) diff --git a/proto/osmosis/gamm/v1beta1/pool.proto b/proto/osmosis/gamm/v1beta1/pool.proto index 19311b813e2..26a8955da14 100644 --- a/proto/osmosis/gamm/v1beta1/pool.proto +++ b/proto/osmosis/gamm/v1beta1/pool.proto @@ -2,7 +2,6 @@ syntax = "proto3"; package osmosis.gamm.v1beta1; import "gogoproto/gogo.proto"; -import "cosmos/base/v1beta1/coin.proto"; option go_package = "github.com/c-osmosis/osmosis/x/gamm/types"; diff --git a/proto/osmosis/gamm/v1beta1/tx.proto b/proto/osmosis/gamm/v1beta1/tx.proto index 8a274449768..d1d84bd21b7 100644 --- a/proto/osmosis/gamm/v1beta1/tx.proto +++ b/proto/osmosis/gamm/v1beta1/tx.proto @@ -191,4 +191,100 @@ message MsgSwapExactAmountOut { (gogoproto.moretags) = "yaml:\"max_price\"", (gogoproto.nullable) = false ]; -} \ No newline at end of file +} + +// ===================== MsgJoinSwapExternAmountIn +message MsgJoinSwapExternAmountIn { + bytes sender = 1 [ + (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress", + (gogoproto.moretags) = "yaml:\"sender\"" + ]; + uint64 targetPool = 2 [ + (gogoproto.moretags) = "yaml:\"target_pool\"" + ]; + string tokenIn = 3 [ + (gogoproto.moretags) = "yaml:\"token_in\"" + ]; + string tokenAmountIn = 4 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.moretags) = "yaml:\"token_amount_in\"", + (gogoproto.nullable) = false + ]; + string minPoolAmountOut = 5 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.moretags) = "yaml:\"min_pool_amount_out\"", + (gogoproto.nullable) = false + ]; +} + +// ===================== MsgJoinSwapPoolAmountOut +message MsgJoinSwapPoolAmountOut { + bytes sender = 1 [ + (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress", + (gogoproto.moretags) = "yaml:\"sender\"" + ]; + uint64 targetPool = 2 [ + (gogoproto.moretags) = "yaml:\"target_pool\"" + ]; + string tokenIn = 3 [ + (gogoproto.moretags) = "yaml:\"token_in\"" + ]; + string poolAmountOut = 4 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.moretags) = "yaml:\"pool_amount_out\"", + (gogoproto.nullable) = false + ]; + string maxAmountIn = 5 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.moretags) = "yaml:\"max_amount_in\"", + (gogoproto.nullable) = false + ]; +} + +// ===================== MsgExitSwapExternAmountOut +message MsgExitSwapExternAmountOut { + bytes sender = 1 [ + (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress", + (gogoproto.moretags) = "yaml:\"sender\"" + ]; + uint64 targetPool = 2 [ + (gogoproto.moretags) = "yaml:\"target_pool\"" + ]; + string tokenOut = 3 [ + (gogoproto.moretags) = "yaml:\"token_out\"" + ]; + string poolAmountIn = 4 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.moretags) = "yaml:\"pool_amount_in\"", + (gogoproto.nullable) = false + ]; + string minAmountOut = 5 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.moretags) = "yaml:\"min_amount_out\"", + (gogoproto.nullable) = false + ]; +} + +// ===================== MsgExitSwapPoolAmountIn +message MsgExitSwapPoolAmountIn { + bytes sender = 1 [ + (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress", + (gogoproto.moretags) = "yaml:\"sender\"" + ]; + uint64 targetPool = 2 [ + (gogoproto.moretags) = "yaml:\"target_pool\"" + ]; + string tokenOut = 3 [ + (gogoproto.moretags) = "yaml:\"token_out\"" + ]; + string tokenAmountOut = 4 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.moretags) = "yaml:\"token_amount_out\"", + (gogoproto.nullable) = false + ]; + string maxPoolAmountIn = 5 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.moretags) = "yaml:\"max_pool_amount_in\"", + (gogoproto.nullable) = false + ]; +} diff --git a/x/gamm/types/pool.pb.go b/x/gamm/types/pool.pb.go index 9472f8e054f..d01a5d24644 100644 --- a/x/gamm/types/pool.pb.go +++ b/x/gamm/types/pool.pb.go @@ -9,7 +9,6 @@ import ( math "math" math_bits "math/bits" - _ "github.com/cosmos/cosmos-sdk/types" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" @@ -189,42 +188,41 @@ func init() { func init() { proto.RegisterFile("osmosis/gamm/v1beta1/pool.proto", fileDescriptor_e5ab9bc6d45f98ce) } var fileDescriptor_e5ab9bc6d45f98ce = []byte{ - // 547 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x94, 0x4f, 0x6f, 0xd3, 0x3e, - 0x18, 0xc7, 0x9b, 0xfe, 0x59, 0x35, 0x77, 0xbf, 0x1f, 0x93, 0xa9, 0xa6, 0xa8, 0x82, 0xa4, 0xf2, - 0x61, 0x94, 0xc3, 0x12, 0xad, 0x5c, 0xa6, 0x9d, 0xa0, 0x6c, 0x48, 0x48, 0x3d, 0x54, 0xe6, 0x00, - 0x8c, 0x43, 0x95, 0x26, 0x26, 0x8b, 0x9a, 0xc4, 0x51, 0xec, 0x6e, 0x14, 0xf1, 0x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, 0xea, 0x37, 0x06, 0x9d, 0xe1, - 0xb3, 0xed, 0x9c, 0xa2, 0xae, 0x96, 0x9c, 0x09, 0x76, 0x19, 0xf3, 0x74, 0x39, 0x3a, 0x52, 0x58, - 0xd5, 0x60, 0x8a, 0x82, 0x70, 0xc9, 0xeb, 0x7d, 0x00, 0x07, 0xd5, 0x00, 0x78, 0x08, 0x1a, 0x73, - 0xb2, 0x94, 0x7d, 0x86, 0x8b, 0x2d, 0x1c, 0x82, 0xd6, 0x8d, 0x13, 0x2e, 0xe4, 0x33, 0x74, 0x86, - 0x4f, 0xb6, 0x5b, 0x4b, 0x08, 0x96, 0xd2, 0xf3, 0xfa, 0x99, 0x36, 0x7a, 0x7d, 0xb7, 0x32, 0xb4, - 0xfb, 0x95, 0xa1, 0xfd, 0x5e, 0x19, 0xda, 0xf7, 0xb5, 0x51, 0xbb, 0x5f, 0x1b, 0xb5, 0x9f, 0x6b, - 0xa3, 0x76, 0xf5, 0xbc, 0x5a, 0xe0, 0x93, 0xf2, 0xcf, 0x28, 0xd7, 0x2f, 0xf2, 0xf7, 0x10, 0x75, - 0x9e, 0xed, 0x89, 0x59, 0x7f, 0xf1, 0x37, 0x00, 0x00, 0xff, 0xff, 0x09, 0x97, 0xbf, 0x3e, 0x5a, - 0x04, 0x00, 0x00, + // 532 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x94, 0xcf, 0x6e, 0xd3, 0x30, + 0x1c, 0xc7, 0x9b, 0xfe, 0x59, 0x35, 0x77, 0xc0, 0x64, 0xaa, 0x29, 0xaa, 0x20, 0xa9, 0x7c, 0x18, + 0xe5, 0xb0, 0x44, 0x2b, 0x97, 0x69, 0x27, 0x28, 0x1b, 0x12, 0x52, 0x0f, 0x95, 0x39, 0x00, 0xe3, + 0x50, 0xa5, 0x89, 0xc9, 0xa2, 0x26, 0x71, 0x14, 0xbb, 0x1b, 0x45, 0x3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xa7, 0xcb, 0xd1, 0x81, 0xc2, + 0xaa, 0x01, 0x53, 0x14, 0x84, 0x4b, 0x5e, 0xef, 0x13, 0xd8, 0xab, 0x06, 0xc0, 0x7d, 0xd0, 0x98, + 0x93, 0xa5, 0x9c, 0x33, 0x5c, 0x6c, 0xe1, 0x10, 0xb4, 0xae, 0x9c, 0x70, 0x21, 0xdb, 0xd0, 0x19, + 0x3e, 0xdb, 0x6c, 0x2d, 0x21, 0x58, 0x4a, 0x4f, 0xeb, 0x27, 0xda, 0xe8, 0xed, 0xcd, 0xca, 0xd0, + 0x6e, 0x57, 0x86, 0xf6, 0x77, 0x65, 0x68, 0x3f, 0xd7, 0x46, 0xed, 0x76, 0x6d, 0xd4, 0x7e, 0xaf, + 0x8d, 0xda, 0xc5, 0xcb, 0x6a, 0x81, 0x8f, 0xca, 0x3f, 0xa1, 0x5c, 0xbf, 0xc9, 0xdf, 0x41, 0xd4, + 0x79, 0xb6, 0x23, 0xde, 0xfa, 0xab, 0xff, 0x01, 0x00, 0x00, 0xff, 0xff, 0x0d, 0xe9, 0x87, 0x90, + 0x3a, 0x04, 0x00, 0x00, } func (m *Record) Marshal() (dAtA []byte, err error) { diff --git a/x/gamm/types/tx.pb.go b/x/gamm/types/tx.pb.go index 4aef188992b..14340434bc4 100644 --- a/x/gamm/types/tx.pb.go +++ b/x/gamm/types/tx.pb.go @@ -243,7 +243,7 @@ func (m *MsgExitPool) GetMinAmountsOut() []MinAmountOut { // ===================== MsgCreatePool type LPTokenInfo struct { Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty" yaml:"denom"` - Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty" yaml:"denom"` + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty" yaml:"description"` } func (m *LPTokenInfo) Reset() { *m = LPTokenInfo{} } @@ -516,6 +516,258 @@ func (m *MsgSwapExactAmountOut) GetTargetPool() github_com_cosmos_cosmos_sdk_typ return nil } +// ===================== MsgJoinSwapExternAmountIn +type MsgJoinSwapExternAmountIn struct { + Sender github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=sender,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"sender,omitempty" yaml:"sender"` + TargetPool uint64 `protobuf:"varint,2,opt,name=targetPool,proto3" json:"targetPool,omitempty" yaml:"target_pool"` + TokenIn string `protobuf:"bytes,3,opt,name=tokenIn,proto3" json:"tokenIn,omitempty" yaml:"token_in"` + TokenAmountIn github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,4,opt,name=tokenAmountIn,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"tokenAmountIn" yaml:"token_amount_in"` + MinPoolAmountOut github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,5,opt,name=minPoolAmountOut,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"minPoolAmountOut" yaml:"min_pool_amount_out"` +} + +func (m *MsgJoinSwapExternAmountIn) Reset() { *m = MsgJoinSwapExternAmountIn{} } +func (m *MsgJoinSwapExternAmountIn) String() string { return proto.CompactTextString(m) } +func (*MsgJoinSwapExternAmountIn) ProtoMessage() {} +func (*MsgJoinSwapExternAmountIn) Descriptor() ([]byte, []int) { + return fileDescriptor_cfc8fd3ac7df3247, []int{9} +} +func (m *MsgJoinSwapExternAmountIn) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgJoinSwapExternAmountIn) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgJoinSwapExternAmountIn.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 *MsgJoinSwapExternAmountIn) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgJoinSwapExternAmountIn.Merge(m, src) +} +func (m *MsgJoinSwapExternAmountIn) XXX_Size() int { + return m.Size() +} +func (m *MsgJoinSwapExternAmountIn) XXX_DiscardUnknown() { + xxx_messageInfo_MsgJoinSwapExternAmountIn.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgJoinSwapExternAmountIn proto.InternalMessageInfo + +func (m *MsgJoinSwapExternAmountIn) GetSender() github_com_cosmos_cosmos_sdk_types.AccAddress { + if m != nil { + return m.Sender + } + return nil +} + +func (m *MsgJoinSwapExternAmountIn) GetTargetPool() uint64 { + if m != nil { + return m.TargetPool + } + return 0 +} + +func (m *MsgJoinSwapExternAmountIn) GetTokenIn() string { + if m != nil { + return m.TokenIn + } + return "" +} + +// ===================== MsgJoinSwapPoolAmountOut +type MsgJoinSwapPoolAmountOut struct { + Sender github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=sender,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"sender,omitempty" yaml:"sender"` + TargetPool uint64 `protobuf:"varint,2,opt,name=targetPool,proto3" json:"targetPool,omitempty" yaml:"target_pool"` + TokenIn string `protobuf:"bytes,3,opt,name=tokenIn,proto3" json:"tokenIn,omitempty" yaml:"token_in"` + PoolAmountOut github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,4,opt,name=poolAmountOut,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"poolAmountOut" yaml:"pool_amount_out"` + MaxAmountIn github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,5,opt,name=maxAmountIn,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"maxAmountIn" yaml:"max_amount_in"` +} + +func (m *MsgJoinSwapPoolAmountOut) Reset() { *m = MsgJoinSwapPoolAmountOut{} } +func (m *MsgJoinSwapPoolAmountOut) String() string { return proto.CompactTextString(m) } +func (*MsgJoinSwapPoolAmountOut) ProtoMessage() {} +func (*MsgJoinSwapPoolAmountOut) Descriptor() ([]byte, []int) { + return fileDescriptor_cfc8fd3ac7df3247, []int{10} +} +func (m *MsgJoinSwapPoolAmountOut) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgJoinSwapPoolAmountOut) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgJoinSwapPoolAmountOut.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 *MsgJoinSwapPoolAmountOut) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgJoinSwapPoolAmountOut.Merge(m, src) +} +func (m *MsgJoinSwapPoolAmountOut) XXX_Size() int { + return m.Size() +} +func (m *MsgJoinSwapPoolAmountOut) XXX_DiscardUnknown() { + xxx_messageInfo_MsgJoinSwapPoolAmountOut.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgJoinSwapPoolAmountOut proto.InternalMessageInfo + +func (m *MsgJoinSwapPoolAmountOut) GetSender() github_com_cosmos_cosmos_sdk_types.AccAddress { + if m != nil { + return m.Sender + } + return nil +} + +func (m *MsgJoinSwapPoolAmountOut) GetTargetPool() uint64 { + if m != nil { + return m.TargetPool + } + return 0 +} + +func (m *MsgJoinSwapPoolAmountOut) GetTokenIn() string { + if m != nil { + return m.TokenIn + } + return "" +} + +// ===================== MsgExitSwapExternAmountOut +type MsgExitSwapExternAmountOut struct { + Sender github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=sender,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"sender,omitempty" yaml:"sender"` + TargetPool uint64 `protobuf:"varint,2,opt,name=targetPool,proto3" json:"targetPool,omitempty" yaml:"target_pool"` + TokenOut string `protobuf:"bytes,3,opt,name=tokenOut,proto3" json:"tokenOut,omitempty" yaml:"token_out"` + PoolAmountIn github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,4,opt,name=poolAmountIn,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"poolAmountIn" yaml:"pool_amount_in"` + MinAmountOut github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,5,opt,name=minAmountOut,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"minAmountOut" yaml:"min_amount_out"` +} + +func (m *MsgExitSwapExternAmountOut) Reset() { *m = MsgExitSwapExternAmountOut{} } +func (m *MsgExitSwapExternAmountOut) String() string { return proto.CompactTextString(m) } +func (*MsgExitSwapExternAmountOut) ProtoMessage() {} +func (*MsgExitSwapExternAmountOut) Descriptor() ([]byte, []int) { + return fileDescriptor_cfc8fd3ac7df3247, []int{11} +} +func (m *MsgExitSwapExternAmountOut) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgExitSwapExternAmountOut) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgExitSwapExternAmountOut.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 *MsgExitSwapExternAmountOut) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgExitSwapExternAmountOut.Merge(m, src) +} +func (m *MsgExitSwapExternAmountOut) XXX_Size() int { + return m.Size() +} +func (m *MsgExitSwapExternAmountOut) XXX_DiscardUnknown() { + xxx_messageInfo_MsgExitSwapExternAmountOut.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgExitSwapExternAmountOut proto.InternalMessageInfo + +func (m *MsgExitSwapExternAmountOut) GetSender() github_com_cosmos_cosmos_sdk_types.AccAddress { + if m != nil { + return m.Sender + } + return nil +} + +func (m *MsgExitSwapExternAmountOut) GetTargetPool() uint64 { + if m != nil { + return m.TargetPool + } + return 0 +} + +func (m *MsgExitSwapExternAmountOut) GetTokenOut() string { + if m != nil { + return m.TokenOut + } + return "" +} + +// ===================== MsgExitSwapPoolAmountIn +type MsgExitSwapPoolAmountIn struct { + Sender github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=sender,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"sender,omitempty" yaml:"sender"` + TargetPool uint64 `protobuf:"varint,2,opt,name=targetPool,proto3" json:"targetPool,omitempty" yaml:"target_pool"` + TokenOut string `protobuf:"bytes,3,opt,name=tokenOut,proto3" json:"tokenOut,omitempty" yaml:"token_out"` + TokenAmountOut github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,4,opt,name=tokenAmountOut,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"tokenAmountOut" yaml:"token_amount_out"` + MaxPoolAmountIn github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,5,opt,name=maxPoolAmountIn,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"maxPoolAmountIn" yaml:"max_pool_amount_in"` +} + +func (m *MsgExitSwapPoolAmountIn) Reset() { *m = MsgExitSwapPoolAmountIn{} } +func (m *MsgExitSwapPoolAmountIn) String() string { return proto.CompactTextString(m) } +func (*MsgExitSwapPoolAmountIn) ProtoMessage() {} +func (*MsgExitSwapPoolAmountIn) Descriptor() ([]byte, []int) { + return fileDescriptor_cfc8fd3ac7df3247, []int{12} +} +func (m *MsgExitSwapPoolAmountIn) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgExitSwapPoolAmountIn) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgExitSwapPoolAmountIn.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 *MsgExitSwapPoolAmountIn) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgExitSwapPoolAmountIn.Merge(m, src) +} +func (m *MsgExitSwapPoolAmountIn) XXX_Size() int { + return m.Size() +} +func (m *MsgExitSwapPoolAmountIn) XXX_DiscardUnknown() { + xxx_messageInfo_MsgExitSwapPoolAmountIn.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgExitSwapPoolAmountIn proto.InternalMessageInfo + +func (m *MsgExitSwapPoolAmountIn) GetSender() github_com_cosmos_cosmos_sdk_types.AccAddress { + if m != nil { + return m.Sender + } + return nil +} + +func (m *MsgExitSwapPoolAmountIn) GetTargetPool() uint64 { + if m != nil { + return m.TargetPool + } + return 0 +} + +func (m *MsgExitSwapPoolAmountIn) GetTokenOut() string { + if m != nil { + return m.TokenOut + } + return "" +} + func init() { proto.RegisterType((*MaxAmountIn)(nil), "osmosis.gamm.v1beta1.MaxAmountIn") proto.RegisterType((*MsgJoinPool)(nil), "osmosis.gamm.v1beta1.MsgJoinPool") @@ -526,69 +778,83 @@ func init() { proto.RegisterType((*MsgCreatePool)(nil), "osmosis.gamm.v1beta1.MsgCreatePool") proto.RegisterType((*MsgSwapExactAmountIn)(nil), "osmosis.gamm.v1beta1.MsgSwapExactAmountIn") proto.RegisterType((*MsgSwapExactAmountOut)(nil), "osmosis.gamm.v1beta1.MsgSwapExactAmountOut") + proto.RegisterType((*MsgJoinSwapExternAmountIn)(nil), "osmosis.gamm.v1beta1.MsgJoinSwapExternAmountIn") + proto.RegisterType((*MsgJoinSwapPoolAmountOut)(nil), "osmosis.gamm.v1beta1.MsgJoinSwapPoolAmountOut") + proto.RegisterType((*MsgExitSwapExternAmountOut)(nil), "osmosis.gamm.v1beta1.MsgExitSwapExternAmountOut") + proto.RegisterType((*MsgExitSwapPoolAmountIn)(nil), "osmosis.gamm.v1beta1.MsgExitSwapPoolAmountIn") } func init() { proto.RegisterFile("osmosis/gamm/v1beta1/tx.proto", fileDescriptor_cfc8fd3ac7df3247) } var fileDescriptor_cfc8fd3ac7df3247 = []byte{ - // 910 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x97, 0x4d, 0x8f, 0xdb, 0x44, - 0x18, 0xc7, 0xd7, 0xdb, 0x6d, 0xb6, 0x9d, 0x24, 0x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74, 0xfc, 0xb8, 0xd4, 0x59, 0x5b, 0xb5, 0xf5, 0x3a, 0x7e, 0xd1, 0x89, 0x95, 0xd0, 0x1c, - 0xdc, 0x7c, 0x0e, 0xae, 0xc5, 0xfe, 0xf4, 0x68, 0x84, 0x03, 0xd4, 0xda, 0x96, 0x42, 0x6e, 0x65, - 0xa1, 0x9d, 0xe2, 0x1e, 0x90, 0x08, 0x10, 0xf4, 0x72, 0x26, 0xfc, 0xa1, 0x06, 0xf6, 0x96, 0xeb, - 0x41, 0x28, 0xbf, 0x29, 0x88, 0x75, 0x0a, 0xe2, 0x04, 0xd4, 0xe3, 0xe2, 0x4a, 0xa6, 0xcb, 0xe1, - 0x71, 0xe5, 0xd4, 0xed, 0x2e, 0x5e, 0xe1, 0xa4, 0x4a, 0x19, 0xfd, 0x9f, 0x96, 0xc2, 0x37, 0xe0, - 0xad, 0x52, 0x5d, 0x16, 0xc5, 0xd0, 0xad, 0x7c, 0xd0, 0x1b, 0x2b, 0xea, 0x5e, 0x8a, 0x2d, 0x08, - 0x5c, 0x76, 0x41, 0xb8, 0x9d, 0x97, 0x67, 0x96, 0xf1, 0xea, 0xcc, 0x32, 0x7e, 0x3b, 0xb3, 0x8c, - 0x1f, 0xcf, 0xad, 0x8d, 0x57, 0xe7, 0xd6, 0xc6, 0x2f, 0xe7, 0xd6, 0xc6, 0xb3, 0x0f, 0xca, 0xfc, - 0x83, 0xec, 0xb3, 0x2d, 0xfb, 0x9d, 0xaa, 0x0f, 0x38, 0x29, 0x33, 0xa8, 0xc9, 0x0f, 0xae, 0x0f, - 0xff, 0x09, 0x00, 0x00, 0xff, 0xff, 0xeb, 0xb6, 0x4b, 0x72, 0xdd, 0x0d, 0x00, 0x00, + // 1071 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x58, 0xcf, 0x6f, 0x1b, 0x45, + 0x14, 0x8e, 0xe3, 0x1f, 0x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0, 0xa7, 0x2c, 0xd8, 0x95, 0xd7, 0xbf, 0x64, 0x13, + 0x5e, 0xd6, 0xda, 0xbd, 0xad, 0xd8, 0xb0, 0x28, 0x5e, 0xe5, 0xc5, 0xe7, 0x88, 0xd8, 0xfd, 0x31, + 0xb7, 0xcc, 0xfb, 0x63, 0xf2, 0xd0, 0x92, 0x5f, 0xe2, 0xa1, 0x05, 0xfe, 0x9c, 0x05, 0xdb, 0x4a, + 0xf9, 0x0e, 0xd4, 0x89, 0x5c, 0x8d, 0xda, 0xcd, 0x6f, 0x7c, 0xb9, 0x65, 0x6f, 0x7c, 0x43, 0x70, + 0x3d, 0xd8, 0xa4, 0x54, 0xc5, 0x88, 0x22, 0x7e, 0x92, 0x9a, 0x73, 0x47, 0xd9, 0xff, 0x12, 0xaa, + 0x49, 0x72, 0x18, 0xcd, 0x93, 0xd3, 0x5a, 0xe6, 0xd9, 0x69, 0x2d, 0xf3, 0xdb, 0x69, 0x2d, 0xf3, + 0xdd, 0x59, 0x6d, 0xe5, 0xd9, 0x59, 0x6d, 0xe5, 0x97, 0xb3, 0xda, 0xca, 0xe3, 0xb7, 0x54, 0xbe, + 0xbd, 0xf0, 0x63, 0x66, 0xf8, 0x3b, 0x16, 0x9f, 0x35, 0x39, 0x6d, 0xb7, 0xc0, 0x3f, 0x43, 0xbe, + 0xfb, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xd2, 0x6b, 0x13, 0x78, 0xf3, 0x14, 0x00, 0x00, } func (m *MaxAmountIn) Marshal() (dAtA []byte, err error) { @@ -1114,77 +1380,325 @@ func (m *MsgSwapExactAmountOut) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func encodeVarintTx(dAtA []byte, offset int, v uint64) int { - offset -= sovTx(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ +func (m *MsgJoinSwapExternAmountIn) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - dAtA[offset] = uint8(v) - return base + return dAtA[:n], nil } -func (m *MaxAmountIn) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Denom) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = m.MaxAmount.Size() - n += 1 + l + sovTx(uint64(l)) - return n + +func (m *MsgJoinSwapExternAmountIn) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgJoinPool) Size() (n int) { - if m == nil { - return 0 - } +func (m *MsgJoinSwapExternAmountIn) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.Sender) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) + { + size := m.MinPoolAmountOut.Size() + i -= size + if _, err := m.MinPoolAmountOut.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + { + size := m.TokenAmountIn.Size() + i -= size + if _, err := m.TokenAmountIn.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + if len(m.TokenIn) > 0 { + i -= len(m.TokenIn) + copy(dAtA[i:], m.TokenIn) + i = encodeVarintTx(dAtA, i, uint64(len(m.TokenIn))) + i-- + dAtA[i] = 0x1a } if m.TargetPool != 0 { - n += 1 + sovTx(uint64(m.TargetPool)) + i = encodeVarintTx(dAtA, i, uint64(m.TargetPool)) + i-- + dAtA[i] = 0x10 } - l = m.PoolAmountOut.Size() - n += 1 + l + sovTx(uint64(l)) - if len(m.MaxAmountsIn) > 0 { - for _, e := range m.MaxAmountsIn { - l = e.Size() - n += 1 + l + sovTx(uint64(l)) - } + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0xa } - return n + return len(dAtA) - i, nil } -func (m *MinAmountOut) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Denom) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) +func (m *MsgJoinSwapPoolAmountOut) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - l = m.MinAmount.Size() - n += 1 + l + sovTx(uint64(l)) - return n + return dAtA[:n], nil } -func (m *MsgExitPool) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l +func (m *MsgJoinSwapPoolAmountOut) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgJoinSwapPoolAmountOut) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.MaxAmountIn.Size() + i -= size + if _, err := m.MaxAmountIn.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + { + size := m.PoolAmountOut.Size() + i -= size + if _, err := m.PoolAmountOut.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + if len(m.TokenIn) > 0 { + i -= len(m.TokenIn) + copy(dAtA[i:], m.TokenIn) + i = encodeVarintTx(dAtA, i, uint64(len(m.TokenIn))) + i-- + dAtA[i] = 0x1a + } + if m.TargetPool != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.TargetPool)) + i-- + dAtA[i] = 0x10 + } + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgExitSwapExternAmountOut) 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 *MsgExitSwapExternAmountOut) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgExitSwapExternAmountOut) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.MinAmountOut.Size() + i -= size + if _, err := m.MinAmountOut.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + { + size := m.PoolAmountIn.Size() + i -= size + if _, err := m.PoolAmountIn.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + if len(m.TokenOut) > 0 { + i -= len(m.TokenOut) + copy(dAtA[i:], m.TokenOut) + i = encodeVarintTx(dAtA, i, uint64(len(m.TokenOut))) + i-- + dAtA[i] = 0x1a + } + if m.TargetPool != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.TargetPool)) + i-- + dAtA[i] = 0x10 + } + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgExitSwapPoolAmountIn) 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 *MsgExitSwapPoolAmountIn) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgExitSwapPoolAmountIn) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.MaxPoolAmountIn.Size() + i -= size + if _, err := m.MaxPoolAmountIn.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + { + size := m.TokenAmountOut.Size() + i -= size + if _, err := m.TokenAmountOut.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + if len(m.TokenOut) > 0 { + i -= len(m.TokenOut) + copy(dAtA[i:], m.TokenOut) + i = encodeVarintTx(dAtA, i, uint64(len(m.TokenOut))) + i-- + dAtA[i] = 0x1a + } + if m.TargetPool != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.TargetPool)) + i-- + dAtA[i] = 0x10 + } + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintTx(dAtA []byte, offset int, v uint64) int { + offset -= sovTx(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MaxAmountIn) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Denom) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.MaxAmount.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgJoinPool) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.TargetPool != 0 { + n += 1 + sovTx(uint64(m.TargetPool)) + } + l = m.PoolAmountOut.Size() + n += 1 + l + sovTx(uint64(l)) + if len(m.MaxAmountsIn) > 0 { + for _, e := range m.MaxAmountsIn { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + return n +} + +func (m *MinAmountOut) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Denom) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.MinAmount.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgExitPool) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l l = len(m.Sender) if l > 0 { n += 1 + l + sovTx(uint64(l)) @@ -1314,22 +1828,821 @@ func (m *MsgSwapExactAmountOut) Size() (n int) { return n } -func sovTx(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozTx(x uint64) (n int) { - return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +func (m *MsgJoinSwapExternAmountIn) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.TargetPool != 0 { + n += 1 + sovTx(uint64(m.TargetPool)) + } + l = len(m.TokenIn) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.TokenAmountIn.Size() + n += 1 + l + sovTx(uint64(l)) + l = m.MinPoolAmountOut.Size() + n += 1 + l + sovTx(uint64(l)) + return n } -func (m *MaxAmountIn) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } + +func (m *MsgJoinSwapPoolAmountOut) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.TargetPool != 0 { + n += 1 + sovTx(uint64(m.TargetPool)) + } + l = len(m.TokenIn) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.PoolAmountOut.Size() + n += 1 + l + sovTx(uint64(l)) + l = m.MaxAmountIn.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgExitSwapExternAmountOut) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.TargetPool != 0 { + n += 1 + sovTx(uint64(m.TargetPool)) + } + l = len(m.TokenOut) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.PoolAmountIn.Size() + n += 1 + l + sovTx(uint64(l)) + l = m.MinAmountOut.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgExitSwapPoolAmountIn) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.TargetPool != 0 { + n += 1 + sovTx(uint64(m.TargetPool)) + } + l = len(m.TokenOut) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.TokenAmountOut.Size() + n += 1 + l + sovTx(uint64(l)) + l = m.MaxPoolAmountIn.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func sovTx(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTx(x uint64) (n int) { + return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MaxAmountIn) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MaxAmountIn: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MaxAmountIn: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denom", 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.Denom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxAmount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MaxAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgJoinPool) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgJoinPool: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgJoinPool: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = append(m.Sender[:0], dAtA[iNdEx:postIndex]...) + if m.Sender == nil { + m.Sender = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TargetPool", wireType) + } + m.TargetPool = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TargetPool |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PoolAmountOut", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.PoolAmountOut.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxAmountsIn", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.MaxAmountsIn = append(m.MaxAmountsIn, MaxAmountIn{}) + if err := m.MaxAmountsIn[len(m.MaxAmountsIn)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MinAmountOut) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MinAmountOut: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MinAmountOut: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denom", 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.Denom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinAmount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MinAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgExitPool) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgExitPool: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgExitPool: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = append(m.Sender[:0], dAtA[iNdEx:postIndex]...) + if m.Sender == nil { + m.Sender = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TargetPool", wireType) + } + m.TargetPool = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TargetPool |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PoolAmountIn", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.PoolAmountIn.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinAmountsOut", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.MinAmountsOut = append(m.MinAmountsOut, MinAmountOut{}) + if err := m.MinAmountsOut[len(m.MinAmountsOut)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *LPTokenInfo) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: LPTokenInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: LPTokenInfo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denom", 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.Denom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 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.Description = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BindTokenInfo) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } if iNdEx >= l { return io.ErrUnexpectedEOF } @@ -1339,19 +2652,51 @@ func (m *MaxAmountIn) Unmarshal(dAtA []byte) error { if b < 0x80 { break } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MaxAmountIn: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MaxAmountIn: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: BindTokenInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BindTokenInfo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denom", 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.Denom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Weight", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1379,11 +2724,13 @@ func (m *MaxAmountIn) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Denom = string(dAtA[iNdEx:postIndex]) + if err := m.Weight.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex - case 2: + case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxAmount", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1411,7 +2758,7 @@ func (m *MaxAmountIn) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.MaxAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -1439,7 +2786,7 @@ func (m *MaxAmountIn) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgJoinPool) Unmarshal(dAtA []byte) error { +func (m *MsgCreatePool) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1462,10 +2809,10 @@ func (m *MsgJoinPool) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgJoinPool: wiretype end group for non-group") + return fmt.Errorf("proto: MsgCreatePool: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgJoinPool: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgCreatePool: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1503,10 +2850,10 @@ func (m *MsgJoinPool) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TargetPool", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SwapFee", wireType) } - m.TargetPool = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -1516,16 +2863,31 @@ func (m *MsgJoinPool) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.TargetPool |= uint64(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.SwapFee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PoolAmountOut", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field LpToken", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -1535,29 +2897,28 @@ func (m *MsgJoinPool) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.PoolAmountOut.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.LpToken.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxAmountsIn", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field BindTokens", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1584,8 +2945,8 @@ func (m *MsgJoinPool) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.MaxAmountsIn = append(m.MaxAmountsIn, MaxAmountIn{}) - if err := m.MaxAmountsIn[len(m.MaxAmountsIn)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.BindTokens = append(m.BindTokens, BindTokenInfo{}) + if err := m.BindTokens[len(m.BindTokens)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -1613,7 +2974,7 @@ func (m *MsgJoinPool) Unmarshal(dAtA []byte) error { } return nil } -func (m *MinAmountOut) Unmarshal(dAtA []byte) error { +func (m *MsgSwapExactAmountIn) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1626,25 +2987,193 @@ func (m *MinAmountOut) Unmarshal(dAtA []byte) error { if iNdEx >= l { return io.ErrUnexpectedEOF } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break + 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: MsgSwapExactAmountIn: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSwapExactAmountIn: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = append(m.Sender[:0], dAtA[iNdEx:postIndex]...) + if m.Sender == nil { + m.Sender = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TargetPool", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TargetPool = append(m.TargetPool[:0], dAtA[iNdEx:postIndex]...) + if m.TargetPool == nil { + m.TargetPool = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TokenIn", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.TokenIn.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TokenAmountIn", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.TokenAmountIn.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TokenOut", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.TokenOut.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MinAmountOut: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MinAmountOut: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: + iNdEx = postIndex + case 6: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MinAmountOut", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1672,11 +3201,13 @@ func (m *MinAmountOut) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Denom = string(dAtA[iNdEx:postIndex]) + if err := m.MinAmountOut.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex - case 2: + case 7: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MinAmount", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MaxPrice", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1704,7 +3235,7 @@ func (m *MinAmountOut) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.MinAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.MaxPrice.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -1732,7 +3263,7 @@ func (m *MinAmountOut) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgExitPool) Unmarshal(dAtA []byte) error { +func (m *MsgSwapExactAmountOut) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1755,10 +3286,10 @@ func (m *MsgExitPool) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgExitPool: wiretype end group for non-group") + return fmt.Errorf("proto: MsgSwapExactAmountOut: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgExitPool: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgSwapExactAmountOut: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1796,10 +3327,10 @@ func (m *MsgExitPool) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 2: - if wireType != 0 { + if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field TargetPool", wireType) } - m.TargetPool = 0 + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -1809,16 +3340,31 @@ func (m *MsgExitPool) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.TargetPool |= uint64(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TargetPool = append(m.TargetPool[:0], dAtA[iNdEx:postIndex]...) + if m.TargetPool == nil { + m.TargetPool = []byte{} + } + iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PoolAmountIn", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field TokenIn", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -1828,31 +3374,30 @@ func (m *MsgExitPool) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.PoolAmountIn.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.TokenIn.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MinAmountsOut", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MaxAmountIn", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -1862,82 +3407,62 @@ func (m *MsgExitPool) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - m.MinAmountsOut = append(m.MinAmountsOut, MinAmountOut{}) - if err := m.MinAmountsOut[len(m.MinAmountsOut)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.MaxAmountIn.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TokenOut", wireType) } - if skippy < 0 { - return ErrInvalidLengthTx + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } } - if (iNdEx + skippy) < 0 { + if msglen < 0 { return ErrInvalidLengthTx } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *LPTokenInfo) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx } - if iNdEx >= l { + if postIndex > l { return io.ErrUnexpectedEOF } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break + if err := m.TokenOut.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: LPTokenInfo: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: LPTokenInfo: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: + iNdEx = postIndex + case 6: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field TokenAmountOut", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1965,11 +3490,13 @@ func (m *LPTokenInfo) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Denom = string(dAtA[iNdEx:postIndex]) + if err := m.TokenAmountOut.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex - case 2: + case 7: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MaxPrice", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1997,7 +3524,9 @@ func (m *LPTokenInfo) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Description = string(dAtA[iNdEx:postIndex]) + if err := m.MaxPrice.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex @@ -2023,7 +3552,7 @@ func (m *LPTokenInfo) Unmarshal(dAtA []byte) error { } return nil } -func (m *BindTokenInfo) Unmarshal(dAtA []byte) error { +func (m *MsgJoinSwapExternAmountIn) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2046,15 +3575,68 @@ func (m *BindTokenInfo) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: BindTokenInfo: wiretype end group for non-group") + return fmt.Errorf("proto: MsgJoinSwapExternAmountIn: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: BindTokenInfo: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgJoinSwapExternAmountIn: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = append(m.Sender[:0], dAtA[iNdEx:postIndex]...) + if m.Sender == nil { + m.Sender = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TargetPool", wireType) + } + m.TargetPool = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TargetPool |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TokenIn", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2082,11 +3664,11 @@ func (m *BindTokenInfo) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Denom = string(dAtA[iNdEx:postIndex]) + m.TokenIn = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 2: + case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Weight", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field TokenAmountIn", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2114,13 +3696,13 @@ func (m *BindTokenInfo) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Weight.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.TokenAmountIn.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 3: + case 5: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MinPoolAmountOut", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2148,7 +3730,7 @@ func (m *BindTokenInfo) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.MinPoolAmountOut.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -2176,7 +3758,7 @@ func (m *BindTokenInfo) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgCreatePool) Unmarshal(dAtA []byte) error { +func (m *MsgJoinSwapPoolAmountOut) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2199,10 +3781,10 @@ func (m *MsgCreatePool) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgCreatePool: wiretype end group for non-group") + return fmt.Errorf("proto: MsgJoinSwapPoolAmountOut: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCreatePool: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgJoinSwapPoolAmountOut: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2238,10 +3820,29 @@ func (m *MsgCreatePool) Unmarshal(dAtA []byte) error { if m.Sender == nil { m.Sender = []byte{} } - iNdEx = postIndex - case 2: + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TargetPool", wireType) + } + m.TargetPool = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TargetPool |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SwapFee", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field TokenIn", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2269,15 +3870,13 @@ func (m *MsgCreatePool) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.SwapFee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.TokenIn = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: + case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LpToken", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field PoolAmountOut", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -2287,30 +3886,31 @@ func (m *MsgCreatePool) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.LpToken.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.PoolAmountOut.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 4: + case 5: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BindTokens", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MaxAmountIn", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -2320,23 +3920,23 @@ func (m *MsgCreatePool) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - m.BindTokens = append(m.BindTokens, BindTokenInfo{}) - if err := m.BindTokens[len(m.BindTokens)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.MaxAmountIn.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -2364,7 +3964,7 @@ func (m *MsgCreatePool) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgSwapExactAmountIn) Unmarshal(dAtA []byte) error { +func (m *MsgExitSwapExternAmountOut) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2387,10 +3987,10 @@ func (m *MsgSwapExactAmountIn) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgSwapExactAmountIn: wiretype end group for non-group") + return fmt.Errorf("proto: MsgExitSwapExternAmountOut: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgSwapExactAmountIn: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgExitSwapExternAmountOut: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2428,10 +4028,10 @@ func (m *MsgSwapExactAmountIn) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 2: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field TargetPool", wireType) } - var byteLen int + m.TargetPool = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -2441,62 +4041,14 @@ func (m *MsgSwapExactAmountIn) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + m.TargetPool |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TargetPool = append(m.TargetPool[:0], dAtA[iNdEx:postIndex]...) - if m.TargetPool == nil { - m.TargetPool = []byte{} - } - iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TokenIn", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.TokenIn.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TokenAmountIn", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field TokenOut", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2524,46 +4076,11 @@ func (m *MsgSwapExactAmountIn) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.TokenAmountIn.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TokenOut", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.TokenOut.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.TokenOut = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 6: + case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MinAmountOut", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field PoolAmountIn", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2591,13 +4108,13 @@ func (m *MsgSwapExactAmountIn) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.MinAmountOut.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.PoolAmountIn.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 7: + case 5: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxPrice", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MinAmountOut", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2625,7 +4142,7 @@ func (m *MsgSwapExactAmountIn) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.MaxPrice.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.MinAmountOut.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -2653,7 +4170,7 @@ func (m *MsgSwapExactAmountIn) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgSwapExactAmountOut) Unmarshal(dAtA []byte) error { +func (m *MsgExitSwapPoolAmountIn) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2676,10 +4193,10 @@ func (m *MsgSwapExactAmountOut) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgSwapExactAmountOut: wiretype end group for non-group") + return fmt.Errorf("proto: MsgExitSwapPoolAmountIn: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgSwapExactAmountOut: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgExitSwapPoolAmountIn: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2717,10 +4234,10 @@ func (m *MsgSwapExactAmountOut) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 2: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field TargetPool", wireType) } - var byteLen int + m.TargetPool = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -2730,62 +4247,14 @@ func (m *MsgSwapExactAmountOut) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + m.TargetPool |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TargetPool = append(m.TargetPool[:0], dAtA[iNdEx:postIndex]...) - if m.TargetPool == nil { - m.TargetPool = []byte{} - } - iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TokenIn", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.TokenIn.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxAmountIn", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field TokenOut", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2813,44 +4282,9 @@ func (m *MsgSwapExactAmountOut) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.MaxAmountIn.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TokenOut", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.TokenOut.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.TokenOut = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 6: + case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field TokenAmountOut", wireType) } @@ -2884,9 +4318,9 @@ func (m *MsgSwapExactAmountOut) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 7: + case 5: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxPrice", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MaxPoolAmountIn", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2914,7 +4348,7 @@ func (m *MsgSwapExactAmountOut) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.MaxPrice.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.MaxPoolAmountIn.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex From a5751a2a08a0bbe682b903b7c47ef6163f98ec4b Mon Sep 17 00:00:00 2001 From: orngefrost Date: Mon, 19 Oct 2020 16:53:54 +0900 Subject: [PATCH 2/3] =?UTF-8?q?feat(x/gamm):=20split=20pool-related=20busi?= =?UTF-8?q?ness=20logic=20*=20add=20single-token=20deposit=20methods=20*?= =?UTF-8?q?=20TODO:=20exit=20=EC=95=88=EB=A7=8C=EB=93=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- x/gamm/keeper/pool/service.go | 251 +---------------- x/gamm/keeper/pool/service_pool.go | 424 +++++++++++++++++++++++++++++ 2 files changed, 428 insertions(+), 247 deletions(-) create mode 100644 x/gamm/keeper/pool/service_pool.go diff --git a/x/gamm/keeper/pool/service.go b/x/gamm/keeper/pool/service.go index c75d310310b..e6d3965bd01 100644 --- a/x/gamm/keeper/pool/service.go +++ b/x/gamm/keeper/pool/service.go @@ -1,8 +1,6 @@ package pool import ( - "fmt" - "github.com/c-osmosis/osmosis/x/gamm/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -18,7 +16,11 @@ type Service interface { // Sender CreatePool(sdk.Context, sdk.AccAddress, sdk.Dec, types.LPTokenInfo, []types.BindTokenInfo) error JoinPool(sdk.Context, sdk.AccAddress, uint64, sdk.Int, []types.MaxAmountIn) error + JoinPoolWithExternAmountIn(sdk.Context, sdk.AccAddress, uint64, string, sdk.Int, sdk.Int) (sdk.Int, error) + JoinPoolWithPoolAmountOut(sdk.Context, sdk.AccAddress, uint64, string, sdk.Int, sdk.Int) (sdk.Int, error) ExitPool(sdk.Context, sdk.AccAddress, uint64, sdk.Int, []types.MinAmountOut) error + ExitPoolWithPoolAmountIn(sdk.Context, sdk.AccAddress, uint64, string, sdk.Int, sdk.Int) (sdk.Int, error) + ExitPoolWithExternAmountOut(sdk.Context, sdk.AccAddress, uint64, string, sdk.Int, sdk.Int) (sdk.Int, error) SwapExactAmountIn(sdk.Context, sdk.AccAddress, uint64, sdk.Coin, sdk.Int, sdk.Coin, sdk.Int, sdk.Int) (sdk.Dec, sdk.Dec, error) SwapExactAmountOut(sdk.Context, sdk.AccAddress, uint64, sdk.Coin, sdk.Int, sdk.Coin, sdk.Int, sdk.Int) (sdk.Dec, sdk.Dec, error) } @@ -102,251 +104,6 @@ func (p poolService) GetSpotPrice(ctx sdk.Context, poolId uint64, tokenIn, token return spotPrice, nil } -func (p poolService) CreatePool( - ctx sdk.Context, - sender sdk.AccAddress, - swapFee sdk.Dec, - lpToken types.LPTokenInfo, - bindTokens []types.BindTokenInfo, -) error { - if len(bindTokens) < 2 { - return sdkerrors.Wrapf( - types.ErrInvalidRequest, - "token info length should be at least 2", - ) - } - - records := make(map[string]types.Record, len(bindTokens)) - for _, info := range bindTokens { - records[info.Denom] = types.Record{ - DenormalizedWeight: info.Weight, - Balance: info.Amount, - } - } - - poolId := p.store.GetNextPoolNumber(ctx) - if lpToken.Denom == "" { - lpToken.Denom = fmt.Sprintf("osmosis/pool/%d", poolId) - } else { - lpToken.Denom = fmt.Sprintf("osmosis/custom/%s", lpToken.Denom) - } - - pool := types.Pool{ - Id: poolId, - SwapFee: swapFee, - Token: types.LP{ - Denom: lpToken.Denom, - Description: lpToken.Description, - TotalSupply: sdk.NewInt(0), - }, - TotalWeight: sdk.NewInt(0), - Records: records, - } - - p.store.StorePool(ctx, pool) - - var coins sdk.Coins - for denom, record := range records { - coins = append(coins, sdk.Coin{ - Denom: denom, - Amount: record.Balance, - }) - } - if coins == nil { - panic("oh my god") - } - coins = coins.Sort() - - return p.bankKeeper.SendCoinsFromAccountToModule( - ctx, - sender, - types.ModuleName, - coins, - ) -} - -func (p poolService) JoinPool( - ctx sdk.Context, - sender sdk.AccAddress, - targetPoolId uint64, - poolAmountOut sdk.Int, - maxAmountsIn []types.MaxAmountIn, -) error { - pool, err := p.store.FetchPool(ctx, targetPoolId) - if err != nil { - return err - } - lpToken := pool.Token - - poolTotal := lpToken.TotalSupply.ToDec() - poolRatio := poolAmountOut.ToDec().Quo(poolTotal) - if poolRatio.Equal(sdk.NewDec(0)) { - return sdkerrors.Wrapf(types.ErrMathApprox, "calc poolRatio") - } - - checker := map[string]bool{} - for _, m := range maxAmountsIn { - if check := checker[m.Denom]; check { - return sdkerrors.Wrapf( - types.ErrInvalidRequest, - "do not use duplicated denom", - ) - } - checker[m.Denom] = true - } - if len(pool.Records) != len(checker) { - return sdkerrors.Wrapf( - types.ErrInvalidRequest, - "invalid maxAmountsIn argument", - ) - } - - var sendTargets sdk.Coins - for _, maxAmountIn := range maxAmountsIn { - var ( - tokenDenom = maxAmountIn.Denom - record, ok = pool.Records[tokenDenom] - tokenAmountIn = poolRatio.Mul(record.Balance.ToDec()).TruncateInt() - ) - if !ok { - return sdkerrors.Wrapf(types.ErrInvalidRequest, "token is not bound to pool") - } - if tokenAmountIn.Equal(sdk.NewInt(0)) { - return sdkerrors.Wrapf(types.ErrMathApprox, "calc tokenAmountIn") - } - if tokenAmountIn.GT(maxAmountIn.MaxAmount) { - return sdkerrors.Wrapf(types.ErrLimitExceed, "max amount limited") - } - record.Balance = record.Balance.Add(tokenAmountIn) - pool.Records[tokenDenom] = record // update record - - sendTargets = append(sendTargets, sdk.Coin{ - Denom: tokenDenom, - Amount: tokenAmountIn, - }) - } - - // process token transfer - err = p.bankKeeper.SendCoinsFromAccountToModule( - ctx, - sender, - types.ModuleName, - sendTargets, - ) - if err != nil { - return err - } - - // process lpToken transfer - poolShare := lpService{ - denom: lpToken.Denom, - bankKeeper: p.bankKeeper, - } - if err := poolShare.mintPoolShare(ctx, poolAmountOut); err != nil { - return err - } - if err := poolShare.pushPoolShare(ctx, sender, poolAmountOut); err != nil { - return err - } - - // save changes - lpToken.TotalSupply = lpToken.TotalSupply.Add(poolAmountOut) - pool.Token = lpToken - p.store.StorePool(ctx, pool) - return nil -} - -func (p poolService) ExitPool( - ctx sdk.Context, - sender sdk.AccAddress, - targetPoolId uint64, - poolAmountIn sdk.Int, - minAmountsOut []types.MinAmountOut, -) error { - pool, err := p.store.FetchPool(ctx, targetPoolId) - if err != nil { - return err - } - lpToken := pool.Token - - poolTotal := lpToken.TotalSupply.ToDec() - poolRatio := poolAmountIn.ToDec().Quo(poolTotal) - if poolRatio.Equal(sdk.NewDec(0)) { - return sdkerrors.Wrapf(types.ErrMathApprox, "calc poolRatio") - } - - checker := map[string]bool{} - for _, m := range minAmountsOut { - if check := checker[m.Denom]; check { - return sdkerrors.Wrapf( - types.ErrInvalidRequest, - "do not use duplicated denom", - ) - } - checker[m.Denom] = true - } - if len(pool.Records) != len(checker) { - return sdkerrors.Wrapf( - types.ErrInvalidRequest, - "invalid minAmountsOut argument", - ) - } - - var sendTargets sdk.Coins - for _, minAmountOut := range minAmountsOut { - var ( - tokenDenom = minAmountOut.Denom - record, ok = pool.Records[tokenDenom] - tokenAmountOut = poolRatio.Mul(record.Balance.ToDec()).TruncateInt() - ) - if !ok { - return sdkerrors.Wrapf(types.ErrInvalidRequest, "token is not bound to pool") - } - if tokenAmountOut.Equal(sdk.NewInt(0)) { - return sdkerrors.Wrapf(types.ErrMathApprox, "calc tokenAmountOut") - } - if tokenAmountOut.LT(minAmountOut.MinAmount) { - return sdkerrors.Wrapf(types.ErrLimitExceed, "min amount limited") - } - record.Balance = record.Balance.Sub(tokenAmountOut) - pool.Records[tokenDenom] = record - - sendTargets = append(sendTargets, sdk.Coin{ - Denom: tokenDenom, - Amount: tokenAmountOut, - }) - } - - // process token transfer - err = p.bankKeeper.SendCoinsFromModuleToAccount( - ctx, - types.ModuleName, - sender, - sendTargets, - ) - if err != nil { - return err - } - - // process lpToken transfer - poolShare := lpService{ - denom: lpToken.Denom, - bankKeeper: p.bankKeeper, - } - if err := poolShare.pullPoolShare(ctx, sender, poolAmountIn); err != nil { - return err - } - if err := poolShare.burnPoolShare(ctx, poolAmountIn); err != nil { - return err - } - - // save changes - lpToken.TotalSupply = lpToken.TotalSupply.Sub(poolAmountIn) - pool.Token = lpToken - p.store.StorePool(ctx, pool) - return nil -} - func (p poolService) SwapExactAmountIn( ctx sdk.Context, sender sdk.AccAddress, diff --git a/x/gamm/keeper/pool/service_pool.go b/x/gamm/keeper/pool/service_pool.go new file mode 100644 index 00000000000..4db5897f7dd --- /dev/null +++ b/x/gamm/keeper/pool/service_pool.go @@ -0,0 +1,424 @@ +package pool + +import ( + "fmt" + + "github.com/c-osmosis/osmosis/x/gamm/types" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +func (p poolService) CreatePool( + ctx sdk.Context, + sender sdk.AccAddress, + swapFee sdk.Dec, + lpToken types.LPTokenInfo, + bindTokens []types.BindTokenInfo, +) error { + if len(bindTokens) < 2 { + return sdkerrors.Wrapf( + types.ErrInvalidRequest, + "token info length should be at least 2", + ) + } + + records := make(map[string]types.Record, len(bindTokens)) + for _, info := range bindTokens { + records[info.Denom] = types.Record{ + DenormalizedWeight: info.Weight, + Balance: info.Amount, + } + } + + poolId := p.store.GetNextPoolNumber(ctx) + if lpToken.Denom == "" { + lpToken.Denom = fmt.Sprintf("osmosis/pool/%d", poolId) + } else { + lpToken.Denom = fmt.Sprintf("osmosis/custom/%s", lpToken.Denom) + } + + pool := types.Pool{ + Id: poolId, + SwapFee: swapFee, + Token: types.LP{ + Denom: lpToken.Denom, + Description: lpToken.Description, + TotalSupply: sdk.NewInt(0), + }, + TotalWeight: sdk.NewInt(0), + Records: records, + } + + p.store.StorePool(ctx, pool) + + var coins sdk.Coins + for denom, record := range records { + coins = append(coins, sdk.Coin{ + Denom: denom, + Amount: record.Balance, + }) + } + if coins == nil { + panic("oh my god") + } + coins = coins.Sort() + + if err := p.bankKeeper.SendCoinsFromAccountToModule( + ctx, + sender, + types.ModuleName, + coins, + ); err != nil { + return err + } + + initialSupply := sdk.NewIntWithDecimal(100, 18) + lp := lpService{ + denom: pool.Token.Denom, + bankKeeper: p.bankKeeper, + } + if err := lp.mintPoolShare(ctx, initialSupply); err != nil { + return err + } + if err := lp.pushPoolShare(ctx, sender, initialSupply); err != nil { + return err + } + return nil +} + +func (p poolService) joinPool( + ctx sdk.Context, + sender sdk.AccAddress, + pool types.Pool, + swapTargets sdk.Coins, + swapAmount sdk.Int, +) error { + // process token transfers + poolShare := lpService{ + denom: pool.Token.Denom, + bankKeeper: p.bankKeeper, + } + if err := poolShare.mintPoolShare(ctx, swapAmount); err != nil { + return err + } + if err := poolShare.pushPoolShare(ctx, sender, swapAmount); err != nil { + return err + } + if err := p.bankKeeper.SendCoinsFromAccountToModule( + ctx, + sender, + types.ModuleName, + swapTargets, + ); err != nil { + return err + } + + // save changes + pool.Token.TotalSupply = pool.Token.TotalSupply.Add(swapAmount) + for _, target := range swapTargets { + record := pool.Records[target.Denom] + record.Balance = record.Balance.Add(target.Amount) + pool.Records[target.Denom] = record + } + p.store.StorePool(ctx, pool) + return nil +} + +func (p poolService) JoinPool( + ctx sdk.Context, + sender sdk.AccAddress, + targetPoolId uint64, + poolAmountOut sdk.Int, + maxAmountsIn []types.MaxAmountIn, +) error { + pool, err := p.store.FetchPool(ctx, targetPoolId) + if err != nil { + return err + } + lpToken := pool.Token + + poolTotal := lpToken.TotalSupply.ToDec() + poolRatio := poolAmountOut.ToDec().Quo(poolTotal) + if poolRatio.Equal(sdk.NewDec(0)) { + return sdkerrors.Wrapf(types.ErrMathApprox, "calc poolRatio") + } + + checker := map[string]bool{} + for _, m := range maxAmountsIn { + if check := checker[m.Denom]; check { + return sdkerrors.Wrapf( + types.ErrInvalidRequest, + "do not use duplicated denom", + ) + } + checker[m.Denom] = true + } + if len(pool.Records) != len(checker) { + return sdkerrors.Wrapf( + types.ErrInvalidRequest, + "invalid maxAmountsIn argument", + ) + } + + var swapTargets sdk.Coins + for _, maxAmountIn := range maxAmountsIn { + var ( + tokenDenom = maxAmountIn.Denom + record, ok = pool.Records[tokenDenom] + tokenAmountIn = poolRatio.Mul(record.Balance.ToDec()).TruncateInt() + ) + if !ok { + return sdkerrors.Wrapf(types.ErrInvalidRequest, "token is not bound to pool") + } + if tokenAmountIn.Equal(sdk.NewInt(0)) { + return sdkerrors.Wrapf(types.ErrMathApprox, "calc tokenAmountIn") + } + if tokenAmountIn.GT(maxAmountIn.MaxAmount) { + return sdkerrors.Wrapf(types.ErrLimitExceed, "max amount limited") + } + record.Balance = record.Balance.Add(tokenAmountIn) + pool.Records[tokenDenom] = record // update record + + swapTargets = append(swapTargets, sdk.Coin{ + Denom: tokenDenom, + Amount: tokenAmountIn, + }) + } + return p.joinPool(ctx, sender, pool, swapTargets, poolAmountOut) +} + +func (p poolService) JoinPoolWithExternAmountIn( + ctx sdk.Context, + sender sdk.AccAddress, + targetPoolId uint64, + tokenIn string, + tokenAmountIn sdk.Int, + minPoolAmountOut sdk.Int, +) (sdk.Int, error) { + pool, err := p.store.FetchPool(ctx, targetPoolId) + if err != nil { + return sdk.Int{}, err + } + + record, ok := pool.Records[tokenIn] + if !ok { + return sdk.Int{}, sdkerrors.Wrapf( + types.ErrNotBound, + "token %s is not bound to this pool", tokenIn, + ) + } + + // TODO: + // require(tokenAmountIn <= bmul(_records[tokenIn].balance, MAX_IN_RATIO), "ERR_MAX_IN_RATIO"); + + poolAmountOut := calcPoolOutGivenSingleIn( + record.Balance.ToDec(), + record.DenormalizedWeight, + pool.Token.TotalSupply.ToDec(), + pool.TotalWeight.ToDec(), + tokenAmountIn.ToDec(), + pool.SwapFee, + ).TruncateInt() + + if poolAmountOut.LT(minPoolAmountOut) { + return sdk.Int{}, sdkerrors.Wrapf( + types.ErrLimitOut, + "poolShare minimum limit has exceeded", + ) + } + + if err := p.joinPool( + ctx, + sender, + pool, + sdk.Coins{{tokenIn, tokenAmountIn}}, + poolAmountOut, + ); err != nil { + return sdk.Int{}, err + } + + return poolAmountOut, nil +} + +func (p poolService) JoinPoolWithPoolAmountOut( + ctx sdk.Context, + sender sdk.AccAddress, + targetPoolId uint64, + tokenIn string, + poolAmountOut sdk.Int, + maxAmountIn sdk.Int, +) (sdk.Int, error) { + pool, err := p.store.FetchPool(ctx, targetPoolId) + if err != nil { + return sdk.Int{}, err + } + + record, ok := pool.Records[tokenIn] + if !ok { + return sdk.Int{}, sdkerrors.Wrapf( + types.ErrNotBound, + "token %s is not bound to this pool", tokenIn, + ) + } + + tokenAmountIn := calcSingleInGivenPoolOut( + record.Balance.ToDec(), + record.DenormalizedWeight, + pool.Token.TotalSupply.ToDec(), + pool.TotalWeight.ToDec(), + poolAmountOut.ToDec(), + pool.SwapFee, + ).TruncateInt() + if tokenAmountIn.Equal(sdk.NewInt(0)) { + return sdk.Int{}, sdkerrors.Wrapf( + types.ErrMathApprox, + "calculate tokenAmountIn", + ) + } + if tokenAmountIn.GT(maxAmountIn) { + return sdk.Int{}, sdkerrors.Wrapf( + types.ErrLimitIn, + "tokenAmount maximum limit has exceeded", + ) + } + + // TODO: + // require(tokenAmountIn <= bmul(_records[tokenIn].balance, MAX_IN_RATIO), "ERR_MAX_IN_RATIO"); + + if err := p.joinPool( + ctx, + sender, + pool, + sdk.Coins{{tokenIn, tokenAmountIn}}, + poolAmountOut, + ); err != nil { + return sdk.Int{}, err + } + + return poolAmountOut, nil +} + +func (p poolService) exitPool( + ctx sdk.Context, + sender sdk.AccAddress, + pool types.Pool, + swapTarget sdk.Int, + swapAmounts sdk.Coins, +) error { + poolShare := lpService{ + denom: pool.Token.Denom, + bankKeeper: p.bankKeeper, + } + if err := poolShare.pullPoolShare(ctx, sender, swapTarget); err != nil { + return err + } + if err := poolShare.burnPoolShare(ctx, swapTarget); err != nil { + return err + } + err := p.bankKeeper.SendCoinsFromModuleToAccount( + ctx, + types.ModuleName, + sender, + swapAmounts, + ) + if err != nil { + return err + } + + // save changes + pool.Token.TotalSupply = pool.Token.TotalSupply.Sub(swapTarget) + for _, target := range swapAmounts { + record := pool.Records[target.Denom] + record.Balance = record.Balance.Sub(target.Amount) + pool.Records[target.Denom] = record + } + p.store.StorePool(ctx, pool) + return nil +} + +func (p poolService) ExitPool( + ctx sdk.Context, + sender sdk.AccAddress, + targetPoolId uint64, + poolAmountIn sdk.Int, + minAmountsOut []types.MinAmountOut, +) error { + pool, err := p.store.FetchPool(ctx, targetPoolId) + if err != nil { + return err + } + lpToken := pool.Token + + poolTotal := lpToken.TotalSupply.ToDec() + poolRatio := poolAmountIn.ToDec().Quo(poolTotal) + if poolRatio.Equal(sdk.NewDec(0)) { + return sdkerrors.Wrapf(types.ErrMathApprox, "calc poolRatio") + } + + checker := map[string]bool{} + for _, m := range minAmountsOut { + if check := checker[m.Denom]; check { + return sdkerrors.Wrapf( + types.ErrInvalidRequest, + "do not use duplicated denom", + ) + } + checker[m.Denom] = true + } + if len(pool.Records) != len(checker) { + return sdkerrors.Wrapf( + types.ErrInvalidRequest, + "invalid minAmountsOut argument", + ) + } + + var swapAmounts sdk.Coins + for _, minAmountOut := range minAmountsOut { + var ( + tokenDenom = minAmountOut.Denom + record, ok = pool.Records[tokenDenom] + tokenAmountOut = poolRatio.Mul(record.Balance.ToDec()).TruncateInt() + ) + if !ok { + return sdkerrors.Wrapf(types.ErrInvalidRequest, "token is not bound to pool") + } + if tokenAmountOut.Equal(sdk.NewInt(0)) { + return sdkerrors.Wrapf(types.ErrMathApprox, "calc tokenAmountOut") + } + if tokenAmountOut.LT(minAmountOut.MinAmount) { + return sdkerrors.Wrapf(types.ErrLimitExceed, "min amount limited") + } + record.Balance = record.Balance.Sub(tokenAmountOut) + pool.Records[tokenDenom] = record + + swapAmounts = append(swapAmounts, sdk.Coin{ + Denom: tokenDenom, + Amount: tokenAmountOut, + }) + } + return p.exitPool(ctx, sender, pool, poolAmountIn, swapAmounts) +} + +func (p poolService) ExitPoolWithPoolAmountIn( + ctx sdk.Context, + sender sdk.AccAddress, + targetPoolId uint64, + tokenOut string, + poolAmountIn sdk.Int, + minAmountOut sdk.Int, +) (sdk.Int, error) { + // TODO + return sdk.Int{}, nil +} + +func (p poolService) ExitPoolWithExternAmountOut( + ctx sdk.Context, + sender sdk.AccAddress, + targetPoolId uint64, + tokenOut string, + tokenAmountOut sdk.Int, + maxPoolAmountIn sdk.Int, +) (sdk.Int, error) { + // TODO + return sdk.Int{}, nil +} From ff6e0899a053b87a16bba7807e1e9f130c51b9e3 Mon Sep 17 00:00:00 2001 From: orngefrost Date: Mon, 19 Oct 2020 17:14:53 +0900 Subject: [PATCH 3/3] feat(x/gamm): complete single-token deposit logic --- x/gamm/keeper/pool/service_pool.go | 94 ++++++++++++++++++++++++++++-- 1 file changed, 90 insertions(+), 4 deletions(-) diff --git a/x/gamm/keeper/pool/service_pool.go b/x/gamm/keeper/pool/service_pool.go index 4db5897f7dd..7e977e70dc5 100644 --- a/x/gamm/keeper/pool/service_pool.go +++ b/x/gamm/keeper/pool/service_pool.go @@ -407,8 +407,48 @@ func (p poolService) ExitPoolWithPoolAmountIn( poolAmountIn sdk.Int, minAmountOut sdk.Int, ) (sdk.Int, error) { - // TODO - return sdk.Int{}, nil + pool, err := p.store.FetchPool(ctx, targetPoolId) + if err != nil { + return sdk.Int{}, err + } + + record, ok := pool.Records[tokenOut] + if !ok { + return sdk.Int{}, sdkerrors.Wrapf( + types.ErrNotBound, + "token %s is not bound to this pool", tokenOut, + ) + } + + tokenAmountOut := calcSingleOutGivenPoolIn( + record.Balance.ToDec(), + record.DenormalizedWeight, + pool.Token.TotalSupply.ToDec(), + pool.TotalWeight.ToDec(), + poolAmountIn.ToDec(), + pool.SwapFee, + ).TruncateInt() + if tokenAmountOut.LT(minAmountOut) { + return sdk.Int{}, sdkerrors.Wrapf( + types.ErrLimitOut, + "tokenAmount minimum limit has exceeded", + ) + } + + // TODO: + // require(tokenAmountOut <= bmul(_records[tokenOut].balance, MAX_OUT_RATIO), "ERR_MAX_OUT_RATIO"); + + if err := p.exitPool( + ctx, + sender, + pool, + poolAmountIn, + sdk.Coins{{tokenOut, tokenAmountOut}}, + ); err != nil { + return sdk.Int{}, err + } + + return tokenAmountOut, nil } func (p poolService) ExitPoolWithExternAmountOut( @@ -419,6 +459,52 @@ func (p poolService) ExitPoolWithExternAmountOut( tokenAmountOut sdk.Int, maxPoolAmountIn sdk.Int, ) (sdk.Int, error) { - // TODO - return sdk.Int{}, nil + pool, err := p.store.FetchPool(ctx, targetPoolId) + if err != nil { + return sdk.Int{}, err + } + + record, ok := pool.Records[tokenOut] + if !ok { + return sdk.Int{}, sdkerrors.Wrapf( + types.ErrNotBound, + "token %s is not bound to this pool", tokenOut, + ) + } + + // TOOD: + // require(tokenAmountOut <= bmul(_records[tokenOut].balance, MAX_OUT_RATIO), "ERR_MAX_OUT_RATIO"); + + poolAmountIn := calcPoolInGivenSingleOut( + record.Balance.ToDec(), + record.DenormalizedWeight, + pool.Token.TotalSupply.ToDec(), + pool.TotalWeight.ToDec(), + tokenAmountOut.ToDec(), + pool.SwapFee, + ).TruncateInt() + if poolAmountIn.Equal(sdk.NewInt(0)) { + return sdk.Int{}, sdkerrors.Wrapf( + types.ErrMathApprox, + "calculate poolAmountIn", + ) + } + if poolAmountIn.GT(maxPoolAmountIn) { + return sdk.Int{}, sdkerrors.Wrapf( + types.ErrLimitIn, + "poolAmount maximum limit has exceeded", + ) + } + + if err := p.exitPool( + ctx, + sender, + pool, + poolAmountIn, + sdk.Coins{{tokenOut, tokenAmountOut}}, + ); err != nil { + return sdk.Int{}, err + } + + return poolAmountIn, nil }