diff --git a/api/irismod/coinswap/tx.pulsar.go b/api/irismod/coinswap/tx.pulsar.go index 8826a56e..a2bc1594 100644 --- a/api/irismod/coinswap/tx.pulsar.go +++ b/api/irismod/coinswap/tx.pulsar.go @@ -5191,12 +5191,14 @@ func (x *fastReflection_MsgSwapOrder) ProtoMethods() *protoiface.Methods { } var ( - md_MsgSwapCoinResponse protoreflect.MessageDescriptor + md_MsgSwapCoinResponse protoreflect.MessageDescriptor + fd_MsgSwapCoinResponse_amount protoreflect.FieldDescriptor ) func init() { file_irismod_coinswap_tx_proto_init() md_MsgSwapCoinResponse = File_irismod_coinswap_tx_proto.Messages().ByName("MsgSwapCoinResponse") + fd_MsgSwapCoinResponse_amount = md_MsgSwapCoinResponse.Fields().ByName("amount") } var _ protoreflect.Message = (*fastReflection_MsgSwapCoinResponse)(nil) @@ -5264,6 +5266,12 @@ func (x *fastReflection_MsgSwapCoinResponse) Interface() protoreflect.ProtoMessa // While iterating, mutating operations may only be performed // on the current field descriptor. func (x *fastReflection_MsgSwapCoinResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Amount != nil { + value := protoreflect.ValueOfMessage(x.Amount.ProtoReflect()) + if !f(fd_MsgSwapCoinResponse_amount, value) { + return + } + } } // Has reports whether a field is populated. @@ -5279,6 +5287,8 @@ func (x *fastReflection_MsgSwapCoinResponse) Range(f func(protoreflect.FieldDesc // a repeated field is populated if it is non-empty. func (x *fastReflection_MsgSwapCoinResponse) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { + case "irismod.coinswap.MsgSwapCoinResponse.amount": + return x.Amount != nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.coinswap.MsgSwapCoinResponse")) @@ -5295,6 +5305,8 @@ func (x *fastReflection_MsgSwapCoinResponse) Has(fd protoreflect.FieldDescriptor // Clear is a mutating operation and unsafe for concurrent use. func (x *fastReflection_MsgSwapCoinResponse) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { + case "irismod.coinswap.MsgSwapCoinResponse.amount": + x.Amount = nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.coinswap.MsgSwapCoinResponse")) @@ -5311,6 +5323,9 @@ func (x *fastReflection_MsgSwapCoinResponse) Clear(fd protoreflect.FieldDescript // of the value; to obtain a mutable reference, use Mutable. func (x *fastReflection_MsgSwapCoinResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { + case "irismod.coinswap.MsgSwapCoinResponse.amount": + value := x.Amount + return protoreflect.ValueOfMessage(value.ProtoReflect()) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.coinswap.MsgSwapCoinResponse")) @@ -5331,6 +5346,8 @@ func (x *fastReflection_MsgSwapCoinResponse) Get(descriptor protoreflect.FieldDe // Set is a mutating operation and unsafe for concurrent use. func (x *fastReflection_MsgSwapCoinResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { + case "irismod.coinswap.MsgSwapCoinResponse.amount": + x.Amount = value.Message().Interface().(*v1beta1.Coin) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.coinswap.MsgSwapCoinResponse")) @@ -5351,6 +5368,11 @@ func (x *fastReflection_MsgSwapCoinResponse) Set(fd protoreflect.FieldDescriptor // Mutable is a mutating operation and unsafe for concurrent use. func (x *fastReflection_MsgSwapCoinResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { + case "irismod.coinswap.MsgSwapCoinResponse.amount": + if x.Amount == nil { + x.Amount = new(v1beta1.Coin) + } + return protoreflect.ValueOfMessage(x.Amount.ProtoReflect()) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.coinswap.MsgSwapCoinResponse")) @@ -5364,6 +5386,9 @@ func (x *fastReflection_MsgSwapCoinResponse) Mutable(fd protoreflect.FieldDescri // For lists, maps, and messages, this returns a new, empty, mutable value. func (x *fastReflection_MsgSwapCoinResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { + case "irismod.coinswap.MsgSwapCoinResponse.amount": + m := new(v1beta1.Coin) + return protoreflect.ValueOfMessage(m.ProtoReflect()) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.coinswap.MsgSwapCoinResponse")) @@ -5433,6 +5458,10 @@ func (x *fastReflection_MsgSwapCoinResponse) ProtoMethods() *protoiface.Methods var n int var l int _ = l + if x.Amount != nil { + l = options.Size(x.Amount) + n += 1 + l + runtime.Sov(uint64(l)) + } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -5462,6 +5491,20 @@ func (x *fastReflection_MsgSwapCoinResponse) ProtoMethods() *protoiface.Methods i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } + if x.Amount != nil { + encoded, err := options.Marshal(x.Amount) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } if input.Buf != nil { input.Buf = append(input.Buf, dAtA...) } else { @@ -5511,6 +5554,42 @@ func (x *fastReflection_MsgSwapCoinResponse) ProtoMethods() *protoiface.Methods return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgSwapCoinResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Amount == nil { + x.Amount = &v1beta1.Coin{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Amount); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -6898,6 +6977,8 @@ type MsgSwapCoinResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + + Amount *v1beta1.Coin `protobuf:"bytes,1,opt,name=amount,proto3" json:"amount,omitempty"` } func (x *MsgSwapCoinResponse) Reset() { @@ -6920,6 +7001,13 @@ func (*MsgSwapCoinResponse) Descriptor() ([]byte, []int) { return file_irismod_coinswap_tx_proto_rawDescGZIP(), []int{9} } +func (x *MsgSwapCoinResponse) GetAmount() *v1beta1.Coin { + if x != nil { + return x.Amount + } + return nil +} + // MsgUpdateParams is the Msg/UpdateParams request type. // // Since: cosmos-sdk 0.47 @@ -7137,71 +7225,75 @@ var file_irismod_coinswap_tx_proto_rawDesc = []byte{ 0x61, 0x64, 0x6c, 0x69, 0x6e, 0x65, 0x12, 0x20, 0x0a, 0x0c, 0x69, 0x73, 0x5f, 0x62, 0x75, 0x79, 0x5f, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x69, 0x73, 0x42, 0x75, 0x79, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x3a, 0x0b, 0x82, 0xe7, 0xb0, 0x2a, 0x06, 0x69, - 0x6e, 0x70, 0x75, 0x74, 0x73, 0x22, 0x15, 0x0a, 0x13, 0x4d, 0x73, 0x67, 0x53, 0x77, 0x61, 0x70, - 0x43, 0x6f, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x91, 0x01, 0x0a, - 0x0f, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, - 0x12, 0x36, 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, - 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x09, 0x61, - 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x12, 0x36, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, - 0x6d, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, - 0x6f, 0x64, 0x2e, 0x63, 0x6f, 0x69, 0x6e, 0x73, 0x77, 0x61, 0x70, 0x2e, 0x50, 0x61, 0x72, 0x61, - 0x6d, 0x73, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, - 0x3a, 0x0e, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, - 0x22, 0x19, 0x0a, 0x17, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, - 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xfd, 0x04, 0x0a, 0x03, - 0x4d, 0x73, 0x67, 0x12, 0x5c, 0x0a, 0x0c, 0x41, 0x64, 0x64, 0x4c, 0x69, 0x71, 0x75, 0x69, 0x64, - 0x69, 0x74, 0x79, 0x12, 0x21, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x63, 0x6f, - 0x69, 0x6e, 0x73, 0x77, 0x61, 0x70, 0x2e, 0x4d, 0x73, 0x67, 0x41, 0x64, 0x64, 0x4c, 0x69, 0x71, - 0x75, 0x69, 0x64, 0x69, 0x74, 0x79, 0x1a, 0x29, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, - 0x2e, 0x63, 0x6f, 0x69, 0x6e, 0x73, 0x77, 0x61, 0x70, 0x2e, 0x4d, 0x73, 0x67, 0x41, 0x64, 0x64, - 0x4c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x69, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x7a, 0x0a, 0x16, 0x41, 0x64, 0x64, 0x55, 0x6e, 0x69, 0x6c, 0x61, 0x74, 0x65, 0x72, - 0x61, 0x6c, 0x4c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x69, 0x74, 0x79, 0x12, 0x2b, 0x2e, 0x69, 0x72, + 0x6e, 0x70, 0x75, 0x74, 0x73, 0x22, 0x4e, 0x0a, 0x13, 0x4d, 0x73, 0x67, 0x53, 0x77, 0x61, 0x70, + 0x43, 0x6f, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x37, 0x0a, 0x06, + 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x06, 0x61, + 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x91, 0x01, 0x0a, 0x0f, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x36, 0x0a, 0x09, 0x61, 0x75, 0x74, + 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, + 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, + 0x79, 0x12, 0x36, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x18, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x63, 0x6f, 0x69, 0x6e, + 0x73, 0x77, 0x61, 0x70, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x04, 0xc8, 0xde, 0x1f, + 0x00, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x3a, 0x0e, 0x82, 0xe7, 0xb0, 0x2a, 0x09, + 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x22, 0x19, 0x0a, 0x17, 0x4d, 0x73, 0x67, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xfd, 0x04, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x5c, 0x0a, 0x0c, + 0x41, 0x64, 0x64, 0x4c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x69, 0x74, 0x79, 0x12, 0x21, 0x2e, 0x69, + 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x63, 0x6f, 0x69, 0x6e, 0x73, 0x77, 0x61, 0x70, 0x2e, + 0x4d, 0x73, 0x67, 0x41, 0x64, 0x64, 0x4c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x69, 0x74, 0x79, 0x1a, + 0x29, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x63, 0x6f, 0x69, 0x6e, 0x73, 0x77, + 0x61, 0x70, 0x2e, 0x4d, 0x73, 0x67, 0x41, 0x64, 0x64, 0x4c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x69, + 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x7a, 0x0a, 0x16, 0x41, 0x64, + 0x64, 0x55, 0x6e, 0x69, 0x6c, 0x61, 0x74, 0x65, 0x72, 0x61, 0x6c, 0x4c, 0x69, 0x71, 0x75, 0x69, + 0x64, 0x69, 0x74, 0x79, 0x12, 0x2b, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x63, + 0x6f, 0x69, 0x6e, 0x73, 0x77, 0x61, 0x70, 0x2e, 0x4d, 0x73, 0x67, 0x41, 0x64, 0x64, 0x55, 0x6e, + 0x69, 0x6c, 0x61, 0x74, 0x65, 0x72, 0x61, 0x6c, 0x4c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x69, 0x74, + 0x79, 0x1a, 0x33, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x63, 0x6f, 0x69, 0x6e, + 0x73, 0x77, 0x61, 0x70, 0x2e, 0x4d, 0x73, 0x67, 0x41, 0x64, 0x64, 0x55, 0x6e, 0x69, 0x6c, 0x61, + 0x74, 0x65, 0x72, 0x61, 0x6c, 0x4c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x69, 0x74, 0x79, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x65, 0x0a, 0x0f, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, + 0x4c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x69, 0x74, 0x79, 0x12, 0x24, 0x2e, 0x69, 0x72, 0x69, 0x73, + 0x6d, 0x6f, 0x64, 0x2e, 0x63, 0x6f, 0x69, 0x6e, 0x73, 0x77, 0x61, 0x70, 0x2e, 0x4d, 0x73, 0x67, + 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x69, 0x74, 0x79, 0x1a, + 0x2c, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x63, 0x6f, 0x69, 0x6e, 0x73, 0x77, + 0x61, 0x70, 0x2e, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4c, 0x69, 0x71, 0x75, + 0x69, 0x64, 0x69, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x83, 0x01, + 0x0a, 0x19, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x55, 0x6e, 0x69, 0x6c, 0x61, 0x74, 0x65, 0x72, + 0x61, 0x6c, 0x4c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x69, 0x74, 0x79, 0x12, 0x2e, 0x2e, 0x69, 0x72, + 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x63, 0x6f, 0x69, 0x6e, 0x73, 0x77, 0x61, 0x70, 0x2e, 0x4d, + 0x73, 0x67, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x55, 0x6e, 0x69, 0x6c, 0x61, 0x74, 0x65, 0x72, + 0x61, 0x6c, 0x4c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x69, 0x74, 0x79, 0x1a, 0x36, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x63, 0x6f, 0x69, 0x6e, 0x73, 0x77, 0x61, 0x70, 0x2e, 0x4d, - 0x73, 0x67, 0x41, 0x64, 0x64, 0x55, 0x6e, 0x69, 0x6c, 0x61, 0x74, 0x65, 0x72, 0x61, 0x6c, 0x4c, - 0x69, 0x71, 0x75, 0x69, 0x64, 0x69, 0x74, 0x79, 0x1a, 0x33, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, - 0x6f, 0x64, 0x2e, 0x63, 0x6f, 0x69, 0x6e, 0x73, 0x77, 0x61, 0x70, 0x2e, 0x4d, 0x73, 0x67, 0x41, - 0x64, 0x64, 0x55, 0x6e, 0x69, 0x6c, 0x61, 0x74, 0x65, 0x72, 0x61, 0x6c, 0x4c, 0x69, 0x71, 0x75, - 0x69, 0x64, 0x69, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x65, 0x0a, - 0x0f, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x69, 0x74, 0x79, - 0x12, 0x24, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x63, 0x6f, 0x69, 0x6e, 0x73, - 0x77, 0x61, 0x70, 0x2e, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4c, 0x69, 0x71, - 0x75, 0x69, 0x64, 0x69, 0x74, 0x79, 0x1a, 0x2c, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, - 0x2e, 0x63, 0x6f, 0x69, 0x6e, 0x73, 0x77, 0x61, 0x70, 0x2e, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x6d, - 0x6f, 0x76, 0x65, 0x4c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x69, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x83, 0x01, 0x0a, 0x19, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x55, - 0x6e, 0x69, 0x6c, 0x61, 0x74, 0x65, 0x72, 0x61, 0x6c, 0x4c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x69, - 0x74, 0x79, 0x12, 0x2e, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x63, 0x6f, 0x69, - 0x6e, 0x73, 0x77, 0x61, 0x70, 0x2e, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x55, - 0x6e, 0x69, 0x6c, 0x61, 0x74, 0x65, 0x72, 0x61, 0x6c, 0x4c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x69, - 0x74, 0x79, 0x1a, 0x36, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x63, 0x6f, 0x69, - 0x6e, 0x73, 0x77, 0x61, 0x70, 0x2e, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x55, - 0x6e, 0x69, 0x6c, 0x61, 0x74, 0x65, 0x72, 0x61, 0x6c, 0x4c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x69, - 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x51, 0x0a, 0x08, 0x53, 0x77, - 0x61, 0x70, 0x43, 0x6f, 0x69, 0x6e, 0x12, 0x1e, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, - 0x2e, 0x63, 0x6f, 0x69, 0x6e, 0x73, 0x77, 0x61, 0x70, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x77, 0x61, - 0x70, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x1a, 0x25, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, - 0x2e, 0x63, 0x6f, 0x69, 0x6e, 0x73, 0x77, 0x61, 0x70, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x77, 0x61, - 0x70, 0x43, 0x6f, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5c, 0x0a, - 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x21, 0x2e, - 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x63, 0x6f, 0x69, 0x6e, 0x73, 0x77, 0x61, 0x70, - 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, - 0x1a, 0x29, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x63, 0x6f, 0x69, 0x6e, 0x73, - 0x77, 0x61, 0x70, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, - 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0xb5, 0x01, 0x0a, 0x14, - 0x63, 0x6f, 0x6d, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x63, 0x6f, 0x69, 0x6e, - 0x73, 0x77, 0x61, 0x70, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, - 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x72, 0x69, 0x73, - 0x6e, 0x65, 0x74, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, - 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2f, 0x63, 0x6f, 0x69, 0x6e, 0x73, 0x77, 0x61, 0x70, - 0xa2, 0x02, 0x03, 0x49, 0x43, 0x58, 0xaa, 0x02, 0x10, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, - 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x73, 0x77, 0x61, 0x70, 0xca, 0x02, 0x10, 0x49, 0x72, 0x69, 0x73, - 0x6d, 0x6f, 0x64, 0x5c, 0x43, 0x6f, 0x69, 0x6e, 0x73, 0x77, 0x61, 0x70, 0xe2, 0x02, 0x1c, 0x49, - 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x5c, 0x43, 0x6f, 0x69, 0x6e, 0x73, 0x77, 0x61, 0x70, 0x5c, - 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x11, 0x49, 0x72, - 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x3a, 0x3a, 0x43, 0x6f, 0x69, 0x6e, 0x73, 0x77, 0x61, 0x70, 0xc8, - 0xe1, 0x1e, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x73, 0x67, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x55, 0x6e, 0x69, 0x6c, 0x61, 0x74, 0x65, 0x72, + 0x61, 0x6c, 0x4c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x69, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x51, 0x0a, 0x08, 0x53, 0x77, 0x61, 0x70, 0x43, 0x6f, 0x69, 0x6e, 0x12, + 0x1e, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x63, 0x6f, 0x69, 0x6e, 0x73, 0x77, + 0x61, 0x70, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x77, 0x61, 0x70, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x1a, + 0x25, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x63, 0x6f, 0x69, 0x6e, 0x73, 0x77, + 0x61, 0x70, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x77, 0x61, 0x70, 0x43, 0x6f, 0x69, 0x6e, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5c, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x21, 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, + 0x2e, 0x63, 0x6f, 0x69, 0x6e, 0x73, 0x77, 0x61, 0x70, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x29, 0x2e, 0x69, 0x72, 0x69, 0x73, + 0x6d, 0x6f, 0x64, 0x2e, 0x63, 0x6f, 0x69, 0x6e, 0x73, 0x77, 0x61, 0x70, 0x2e, 0x4d, 0x73, 0x67, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x42, 0xb5, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x69, 0x72, 0x69, + 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x63, 0x6f, 0x69, 0x6e, 0x73, 0x77, 0x61, 0x70, 0x42, 0x07, 0x54, + 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6e, 0x65, 0x74, 0x2f, 0x69, 0x72, 0x69, + 0x73, 0x6d, 0x6f, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, + 0x2f, 0x63, 0x6f, 0x69, 0x6e, 0x73, 0x77, 0x61, 0x70, 0xa2, 0x02, 0x03, 0x49, 0x43, 0x58, 0xaa, + 0x02, 0x10, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x73, 0x77, + 0x61, 0x70, 0xca, 0x02, 0x10, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x5c, 0x43, 0x6f, 0x69, + 0x6e, 0x73, 0x77, 0x61, 0x70, 0xe2, 0x02, 0x1c, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x5c, + 0x43, 0x6f, 0x69, 0x6e, 0x73, 0x77, 0x61, 0x70, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x11, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x3a, 0x3a, + 0x43, 0x6f, 0x69, 0x6e, 0x73, 0x77, 0x61, 0x70, 0xc8, 0xe1, 0x1e, 0x00, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -7246,24 +7338,25 @@ var file_irismod_coinswap_tx_proto_depIdxs = []int32{ 12, // 7: irismod.coinswap.MsgRemoveUnilateralLiquidityResponse.withdraw_coins:type_name -> cosmos.base.v1beta1.Coin 13, // 8: irismod.coinswap.MsgSwapOrder.input:type_name -> irismod.coinswap.Input 14, // 9: irismod.coinswap.MsgSwapOrder.output:type_name -> irismod.coinswap.Output - 15, // 10: irismod.coinswap.MsgUpdateParams.params:type_name -> irismod.coinswap.Params - 0, // 11: irismod.coinswap.Msg.AddLiquidity:input_type -> irismod.coinswap.MsgAddLiquidity - 2, // 12: irismod.coinswap.Msg.AddUnilateralLiquidity:input_type -> irismod.coinswap.MsgAddUnilateralLiquidity - 4, // 13: irismod.coinswap.Msg.RemoveLiquidity:input_type -> irismod.coinswap.MsgRemoveLiquidity - 6, // 14: irismod.coinswap.Msg.RemoveUnilateralLiquidity:input_type -> irismod.coinswap.MsgRemoveUnilateralLiquidity - 8, // 15: irismod.coinswap.Msg.SwapCoin:input_type -> irismod.coinswap.MsgSwapOrder - 10, // 16: irismod.coinswap.Msg.UpdateParams:input_type -> irismod.coinswap.MsgUpdateParams - 1, // 17: irismod.coinswap.Msg.AddLiquidity:output_type -> irismod.coinswap.MsgAddLiquidityResponse - 3, // 18: irismod.coinswap.Msg.AddUnilateralLiquidity:output_type -> irismod.coinswap.MsgAddUnilateralLiquidityResponse - 5, // 19: irismod.coinswap.Msg.RemoveLiquidity:output_type -> irismod.coinswap.MsgRemoveLiquidityResponse - 7, // 20: irismod.coinswap.Msg.RemoveUnilateralLiquidity:output_type -> irismod.coinswap.MsgRemoveUnilateralLiquidityResponse - 9, // 21: irismod.coinswap.Msg.SwapCoin:output_type -> irismod.coinswap.MsgSwapCoinResponse - 11, // 22: irismod.coinswap.Msg.UpdateParams:output_type -> irismod.coinswap.MsgUpdateParamsResponse - 17, // [17:23] is the sub-list for method output_type - 11, // [11:17] is the sub-list for method input_type - 11, // [11:11] is the sub-list for extension type_name - 11, // [11:11] is the sub-list for extension extendee - 0, // [0:11] is the sub-list for field type_name + 12, // 10: irismod.coinswap.MsgSwapCoinResponse.amount:type_name -> cosmos.base.v1beta1.Coin + 15, // 11: irismod.coinswap.MsgUpdateParams.params:type_name -> irismod.coinswap.Params + 0, // 12: irismod.coinswap.Msg.AddLiquidity:input_type -> irismod.coinswap.MsgAddLiquidity + 2, // 13: irismod.coinswap.Msg.AddUnilateralLiquidity:input_type -> irismod.coinswap.MsgAddUnilateralLiquidity + 4, // 14: irismod.coinswap.Msg.RemoveLiquidity:input_type -> irismod.coinswap.MsgRemoveLiquidity + 6, // 15: irismod.coinswap.Msg.RemoveUnilateralLiquidity:input_type -> irismod.coinswap.MsgRemoveUnilateralLiquidity + 8, // 16: irismod.coinswap.Msg.SwapCoin:input_type -> irismod.coinswap.MsgSwapOrder + 10, // 17: irismod.coinswap.Msg.UpdateParams:input_type -> irismod.coinswap.MsgUpdateParams + 1, // 18: irismod.coinswap.Msg.AddLiquidity:output_type -> irismod.coinswap.MsgAddLiquidityResponse + 3, // 19: irismod.coinswap.Msg.AddUnilateralLiquidity:output_type -> irismod.coinswap.MsgAddUnilateralLiquidityResponse + 5, // 20: irismod.coinswap.Msg.RemoveLiquidity:output_type -> irismod.coinswap.MsgRemoveLiquidityResponse + 7, // 21: irismod.coinswap.Msg.RemoveUnilateralLiquidity:output_type -> irismod.coinswap.MsgRemoveUnilateralLiquidityResponse + 9, // 22: irismod.coinswap.Msg.SwapCoin:output_type -> irismod.coinswap.MsgSwapCoinResponse + 11, // 23: irismod.coinswap.Msg.UpdateParams:output_type -> irismod.coinswap.MsgUpdateParamsResponse + 18, // [18:24] is the sub-list for method output_type + 12, // [12:18] is the sub-list for method input_type + 12, // [12:12] is the sub-list for extension type_name + 12, // [12:12] is the sub-list for extension extendee + 0, // [0:12] is the sub-list for field type_name } func init() { file_irismod_coinswap_tx_proto_init() } diff --git a/modules/coinswap/keeper/keeper.go b/modules/coinswap/keeper/keeper.go index 6ff7de8f..f21ec8b4 100644 --- a/modules/coinswap/keeper/keeper.go +++ b/modules/coinswap/keeper/keeper.go @@ -61,8 +61,8 @@ func (k Keeper) Logger(ctx sdk.Context) log.Logger { } // Swap execute swap order in specified pool -func (k Keeper) Swap(ctx sdk.Context, msg *types.MsgSwapOrder) error { - var amount sdkmath.Int +func (k Keeper) Swap(ctx sdk.Context, msg *types.MsgSwapOrder) (sdk.Coin, error) { + var amount sdk.Coin var err error standardDenom := k.GetStandardDenom(ctx) @@ -79,7 +79,7 @@ func (k Keeper) Swap(ctx sdk.Context, msg *types.MsgSwapOrder) error { amount, err = k.TradeExactInputForOutput(ctx, msg.Input, msg.Output) } if err != nil { - return err + return amount, err } ctx.EventManager().EmitEvent( @@ -96,7 +96,7 @@ func (k Keeper) Swap(ctx sdk.Context, msg *types.MsgSwapOrder) error { ), ) - return nil + return amount, nil } // AddLiquidity adds liquidity to the specified pool @@ -650,4 +650,4 @@ func (k Keeper) removeUnilateralLiquidity(ctx sdk.Context, coins := sdk.NewCoins(sdk.NewCoin(targetTokenDenom, targetTokenAmtAfterFee)) return coins, k.bk.SendCoins(ctx, poolAddr, sender, coins) -} +} \ No newline at end of file diff --git a/modules/coinswap/keeper/msg_server.go b/modules/coinswap/keeper/msg_server.go index 5d346f2c..7097fb99 100644 --- a/modules/coinswap/keeper/msg_server.go +++ b/modules/coinswap/keeper/msg_server.go @@ -129,10 +129,13 @@ func (m msgServer) SwapCoin( ) } - if err := m.k.Swap(ctx, msg); err != nil { + amount, err := m.k.Swap(ctx, msg) + if err != nil { return nil, err } - return &types.MsgSwapCoinResponse{}, nil + return &types.MsgSwapCoinResponse{ + Amount: amount, + }, nil } func (m msgServer) UpdateParams( diff --git a/modules/coinswap/keeper/swap.go b/modules/coinswap/keeper/swap.go index 3507ad49..c33cdc73 100644 --- a/modules/coinswap/keeper/swap.go +++ b/modules/coinswap/keeper/swap.go @@ -69,34 +69,35 @@ Sell exact amount of a token for buying another, one of them must be standard to @param receipt: address of the receiver @return: actual amount of the token to be bought */ -func (k Keeper) TradeExactInputForOutput(ctx sdk.Context, input types.Input, output types.Output) (sdkmath.Int, error) { +func (k Keeper) TradeExactInputForOutput(ctx sdk.Context, input types.Input, output types.Output) (sdk.Coin, error) { boughtTokenAmt, err := k.calculateWithExactInput(ctx, input.Coin, output.Coin.Denom) if err != nil { - return sdk.ZeroInt(), err + return sdk.Coin{}, err } // assert that the calculated amount is more than the // minimum amount the buyer is willing to buy. if boughtTokenAmt.LT(output.Coin.Amount) { - return sdk.ZeroInt(), sdkerrors.Wrap(types.ErrConstraintNotMet, fmt.Sprintf("insufficient amount of %s, user expected: %s, actual: %s", output.Coin.Denom, output.Coin.Amount.String(), boughtTokenAmt.String())) + return sdk.Coin{}, sdkerrors.Wrap(types.ErrConstraintNotMet, fmt.Sprintf("insufficient amount of %s, user expected: %s, actual: %s", output.Coin.Denom, output.Coin.Amount.String(), boughtTokenAmt.String())) } boughtToken := sdk.NewCoin(output.Coin.Denom, boughtTokenAmt) inputAddress, err := sdk.AccAddressFromBech32(input.Address) if err != nil { - return sdk.ZeroInt(), err + return sdk.Coin{}, err } outputAddress, err := sdk.AccAddressFromBech32(output.Address) if err != nil { - return sdk.ZeroInt(), err + return sdk.Coin{}, err } if err := k.swapCoins(ctx, inputAddress, outputAddress, input.Coin, boughtToken); err != nil { - return sdk.ZeroInt(), err + return sdk.Coin{}, err } - return boughtTokenAmt, nil + return boughtToken, nil } -/** +/* +* Sell exact amount of a token for buying another, non of them are standard token @param input: exact amount of the token to be sold @param output: min amount of the token to be bought @@ -104,45 +105,46 @@ Sell exact amount of a token for buying another, non of them are standard token @param receipt: address of the receiver @return: actual amount of the token to be bought */ -func (k Keeper) doubleTradeExactInputForOutput(ctx sdk.Context, input types.Input, output types.Output) (sdkmath.Int, error) { +func (k Keeper) doubleTradeExactInputForOutput(ctx sdk.Context, input types.Input, output types.Output) (sdk.Coin, error) { standardDenom := k.GetStandardDenom(ctx) standardAmount, err := k.calculateWithExactInput(ctx, input.Coin, standardDenom) if err != nil { - return sdk.ZeroInt(), err + return sdk.Coin{}, err } standardCoin := sdk.NewCoin(standardDenom, standardAmount) inputAddress, err := sdk.AccAddressFromBech32(input.Address) if err != nil { - return sdk.ZeroInt(), err + return sdk.Coin{}, err } outputAddress, err := sdk.AccAddressFromBech32(output.Address) if err != nil { - return sdk.ZeroInt(), err + return sdk.Coin{}, err } if err := k.swapCoins(ctx, inputAddress, outputAddress, input.Coin, standardCoin); err != nil { - return sdk.ZeroInt(), err + return sdk.Coin{}, err } boughtAmt, err := k.calculateWithExactInput(ctx, standardCoin, output.Coin.Denom) if err != nil { - return sdk.ZeroInt(), err + return sdk.Coin{}, err } boughtToken := sdk.NewCoin(output.Coin.Denom, boughtAmt) // assert that the calculated amount is less than the // minimum amount the buyer is willing to buy. if boughtAmt.LT(output.Coin.Amount) { - return sdk.ZeroInt(), sdkerrors.Wrap(types.ErrConstraintNotMet, fmt.Sprintf("insufficient amount of %s, user expected: %s, actual: %s", output.Coin.Denom, output.Coin.Amount.String(), boughtAmt.String())) + return sdk.Coin{}, sdkerrors.Wrap(types.ErrConstraintNotMet, fmt.Sprintf("insufficient amount of %s, user expected: %s, actual: %s", output.Coin.Denom, output.Coin.Amount.String(), boughtAmt.String())) } if err := k.swapCoins(ctx, inputAddress, outputAddress, standardCoin, boughtToken); err != nil { - return sdk.ZeroInt(), err + return sdk.Coin{}, err } - return boughtAmt, nil + return boughtToken, nil } -/** +/* +* Calculate the amount of the token to be paid based on the exact amount of the token to be bought @param exactBoughtCoin @param soldTokenDenom @@ -178,7 +180,8 @@ func (k Keeper) calculateWithExactOutput(ctx sdk.Context, exactBoughtCoin sdk.Co return soldTokenAmt, nil } -/** +/* +* Buy exact amount of a token by specifying the max amount of another token, one of them must be standard token @param input : max amount of the token to be paid @param output : exact amount of the token to be bought @@ -186,34 +189,35 @@ Buy exact amount of a token by specifying the max amount of another token, one o @param receipt : address of the receiver @return : actual amount of the token to be paid */ -func (k Keeper) TradeInputForExactOutput(ctx sdk.Context, input types.Input, output types.Output) (sdkmath.Int, error) { +func (k Keeper) TradeInputForExactOutput(ctx sdk.Context, input types.Input, output types.Output) (sdk.Coin, error) { soldTokenAmt, err := k.calculateWithExactOutput(ctx, output.Coin, input.Coin.Denom) if err != nil { - return sdk.ZeroInt(), err + return sdk.Coin{}, err } // assert that the calculated amount is less than the // max amount the buyer is willing to pay. if soldTokenAmt.GT(input.Coin.Amount) { - return sdk.ZeroInt(), sdkerrors.Wrap(types.ErrConstraintNotMet, fmt.Sprintf("insufficient amount of %s, user expected: %s, actual: %s", input.Coin.Denom, input.Coin.Amount.String(), soldTokenAmt.String())) + return sdk.Coin{}, sdkerrors.Wrap(types.ErrConstraintNotMet, fmt.Sprintf("insufficient amount of %s, user expected: %s, actual: %s", input.Coin.Denom, input.Coin.Amount.String(), soldTokenAmt.String())) } soldToken := sdk.NewCoin(input.Coin.Denom, soldTokenAmt) inputAddress, err := sdk.AccAddressFromBech32(input.Address) if err != nil { - return sdk.ZeroInt(), err + return sdk.Coin{}, err } outputAddress, err := sdk.AccAddressFromBech32(output.Address) if err != nil { - return sdk.ZeroInt(), err + return sdk.Coin{}, err } if err := k.swapCoins(ctx, inputAddress, outputAddress, soldToken, output.Coin); err != nil { - return sdk.ZeroInt(), err + return sdk.Coin{}, err } - return soldTokenAmt, nil + return soldToken, nil } -/** +/* +* Buy exact amount of a token by specifying the max amount of another token, non of them are standard token @param input : max amount of the token to be paid @param output : exact amount of the token to be bought @@ -221,42 +225,42 @@ Buy exact amount of a token by specifying the max amount of another token, non o @param receipt : address of the receiver @return : actual amount of the token to be paid */ -func (k Keeper) doubleTradeInputForExactOutput(ctx sdk.Context, input types.Input, output types.Output) (sdkmath.Int, error) { +func (k Keeper) doubleTradeInputForExactOutput(ctx sdk.Context, input types.Input, output types.Output) (sdk.Coin, error) { standardDenom := k.GetStandardDenom(ctx) soldStandardAmount, err := k.calculateWithExactOutput(ctx, output.Coin, standardDenom) if err != nil { - return sdk.ZeroInt(), err + return sdk.Coin{}, err } soldStandardCoin := sdk.NewCoin(standardDenom, soldStandardAmount) soldTokenAmt, err := k.calculateWithExactOutput(ctx, soldStandardCoin, input.Coin.Denom) if err != nil { - return sdk.ZeroInt(), err + return sdk.Coin{}, err } soldTokenCoin := sdk.NewCoin(input.Coin.Denom, soldTokenAmt) // assert that the calculated amount is less than the // max amount the buyer is willing to sell. if soldTokenAmt.GT(input.Coin.Amount) { - return sdk.ZeroInt(), sdkerrors.Wrap(types.ErrConstraintNotMet, fmt.Sprintf("insufficient amount of %s, user expected: %s, actual: %s", input.Coin.Denom, input.Coin.Amount.String(), soldTokenAmt.String())) + return sdk.Coin{}, sdkerrors.Wrap(types.ErrConstraintNotMet, fmt.Sprintf("insufficient amount of %s, user expected: %s, actual: %s", input.Coin.Denom, input.Coin.Amount.String(), soldTokenAmt.String())) } inputAddress, err := sdk.AccAddressFromBech32(input.Address) if err != nil { - return sdk.ZeroInt(), err + return sdk.Coin{}, err } outputAddress, err := sdk.AccAddressFromBech32(output.Address) if err != nil { - return sdk.ZeroInt(), err + return sdk.Coin{}, err } if err := k.swapCoins(ctx, inputAddress, outputAddress, soldTokenCoin, soldStandardCoin); err != nil { - return sdk.ZeroInt(), err + return sdk.Coin{}, err } if err := k.swapCoins(ctx, inputAddress, outputAddress, soldStandardCoin, output.Coin); err != nil { - return sdk.ZeroInt(), err + return sdk.Coin{}, err } - return soldTokenAmt, nil + return soldTokenCoin, nil } // GetInputPrice returns the amount of coins bought (calculated) given the input amount being sold (exact) diff --git a/modules/coinswap/keeper/swap_test.go b/modules/coinswap/keeper/swap_test.go index 3d83c61c..ec0da58b 100644 --- a/modules/coinswap/keeper/swap_test.go +++ b/modules/coinswap/keeper/swap_test.go @@ -93,7 +93,7 @@ func (suite *TestSuite) TestSwap() { lptDenom := pool.LptDenom // first swap buy order - err := suite.app.CoinswapKeeper.Swap(suite.ctx, msg) + _, err := suite.app.CoinswapKeeper.Swap(suite.ctx, msg) suite.NoError(err) reservePoolBalances := suite.app.BankKeeper.GetAllBalances(suite.ctx, reservePoolAddr) senderBalances := suite.app.BankKeeper.GetAllBalances(suite.ctx, sender) @@ -112,7 +112,7 @@ func (suite *TestSuite) TestSwap() { suite.Equal(expCoins.Sort().String(), senderBalances.Sort().String()) // second swap buy order - err = suite.app.CoinswapKeeper.Swap(suite.ctx, msg) + _, err = suite.app.CoinswapKeeper.Swap(suite.ctx, msg) suite.NoError(err) reservePoolBalances = suite.app.BankKeeper.GetAllBalances(suite.ctx, reservePoolAddr) senderBalances = suite.app.BankKeeper.GetAllBalances(suite.ctx, sender) @@ -139,7 +139,7 @@ func (suite *TestSuite) TestSwap() { ) // first swap sell order - err = suite.app.CoinswapKeeper.Swap(suite.ctx, msg) + _, err = suite.app.CoinswapKeeper.Swap(suite.ctx, msg) suite.NoError(err) reservePoolBalances = suite.app.BankKeeper.GetAllBalances(suite.ctx, reservePoolAddr) senderBalances = suite.app.BankKeeper.GetAllBalances(suite.ctx, sender) @@ -157,7 +157,7 @@ func (suite *TestSuite) TestSwap() { suite.Equal(expCoins.Sort().String(), senderBalances.Sort().String()) // second swap sell order - err = suite.app.CoinswapKeeper.Swap(suite.ctx, msg) + _, err = suite.app.CoinswapKeeper.Swap(suite.ctx, msg) suite.NoError(err) reservePoolBalances = suite.app.BankKeeper.GetAllBalances(suite.ctx, reservePoolAddr) senderBalances = suite.app.BankKeeper.GetAllBalances(suite.ctx, sender) @@ -199,7 +199,7 @@ func (suite *TestSuite) TestDoubleSwap() { lptDenom := pool.LptDenom // first swap buy order - err := suite.app.CoinswapKeeper.Swap(suite.ctx, msg) + _, err := suite.app.CoinswapKeeper.Swap(suite.ctx, msg) suite.NoError(err) reservePoolBTCBalances := suite.app.BankKeeper.GetAllBalances(suite.ctx, reservePoolAddrBTC) reservePoolETHBalances := suite.app.BankKeeper.GetAllBalances(suite.ctx, reservePoolAddrETH) @@ -225,7 +225,7 @@ func (suite *TestSuite) TestDoubleSwap() { suite.Equal(expCoins.Sort().String(), sender1Balances.Sort().String()) // second swap buy order - err = suite.app.CoinswapKeeper.Swap(suite.ctx, msg) + _, err = suite.app.CoinswapKeeper.Swap(suite.ctx, msg) suite.NoError(err) reservePoolBTCBalances = suite.app.BankKeeper.GetAllBalances(suite.ctx, reservePoolAddrBTC) reservePoolETHBalances = suite.app.BankKeeper.GetAllBalances(suite.ctx, reservePoolAddrETH) @@ -260,7 +260,7 @@ func (suite *TestSuite) TestDoubleSwap() { ) // first swap sell order - err = suite.app.CoinswapKeeper.Swap(suite.ctx, msg) + _, err = suite.app.CoinswapKeeper.Swap(suite.ctx, msg) suite.NoError(err) reservePoolBTCBalances = suite.app.BankKeeper.GetAllBalances(suite.ctx, reservePoolAddrBTC) reservePoolETHBalances = suite.app.BankKeeper.GetAllBalances(suite.ctx, reservePoolAddrETH) @@ -286,7 +286,7 @@ func (suite *TestSuite) TestDoubleSwap() { suite.Equal(expCoins.Sort().String(), sender2Balances.Sort().String()) // second swap sell order - err = suite.app.CoinswapKeeper.Swap(suite.ctx, msg) + _, err = suite.app.CoinswapKeeper.Swap(suite.ctx, msg) suite.NoError(err) reservePoolBTCBalances = suite.app.BankKeeper.GetAllBalances(suite.ctx, reservePoolAddrBTC) reservePoolETHBalances = suite.app.BankKeeper.GetAllBalances(suite.ctx, reservePoolAddrETH) @@ -391,7 +391,7 @@ func (suite *TestSuite) TestTradeInputForExactOutput() { suite.NoError(err) bought := sdk.NewCoins(outputCoin) - sold := sdk.NewCoins(sdk.NewCoin(denomStandard, amt)) + sold := sdk.NewCoins(sdk.NewCoin(denomStandard, amt.Amount)) pb := poolBalances.Add(sold...).Sub(bought...) sb := senderBlances.Add(bought...).Sub(sold...) @@ -425,7 +425,7 @@ func (suite *TestSuite) TestTradeExactInputForOutput() { suite.NoError(err) sold := sdk.NewCoins(inputCoin) - bought := sdk.NewCoins(sdk.NewCoin(denomBTC, amt)) + bought := sdk.NewCoins(sdk.NewCoin(denomBTC, amt.Amount)) pb := poolBalances.Add(sold...).Sub(bought...) sb := senderBlances.Add(bought...).Sub(sold...) diff --git a/modules/coinswap/types/tx.pb.go b/modules/coinswap/types/tx.pb.go index dc914df3..67cf40f0 100644 --- a/modules/coinswap/types/tx.pb.go +++ b/modules/coinswap/types/tx.pb.go @@ -398,6 +398,7 @@ var xxx_messageInfo_MsgSwapOrder proto.InternalMessageInfo // MsgSwapCoinResponse defines the Msg/SwapCoin response type type MsgSwapCoinResponse struct { + Amount types.Coin `protobuf:"bytes,1,opt,name=amount,proto3" json:"amount"` } func (m *MsgSwapCoinResponse) Reset() { *m = MsgSwapCoinResponse{} } @@ -537,65 +538,65 @@ func init() { func init() { proto.RegisterFile("irismod/coinswap/tx.proto", fileDescriptor_828eca8448acda28) } var fileDescriptor_828eca8448acda28 = []byte{ - // 914 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x56, 0xdd, 0x6e, 0xe3, 0x44, - 0x14, 0x8e, 0x93, 0x6e, 0x95, 0x9c, 0x76, 0xdb, 0xae, 0x59, 0x68, 0x12, 0x21, 0x37, 0x1b, 0x2d, - 0xa8, 0xfc, 0xd4, 0xa1, 0x5b, 0xa9, 0x42, 0xab, 0xbd, 0xa0, 0x05, 0x21, 0xad, 0xa0, 0x14, 0x1c, - 0x56, 0x20, 0xb4, 0x28, 0x9a, 0x64, 0x46, 0xee, 0x68, 0xe3, 0x19, 0xe3, 0x19, 0xb7, 0x0d, 0x97, - 0xf0, 0x02, 0xf0, 0x26, 0x5c, 0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a, 0x50, 0x9b, - 0xbe, 0x86, 0xdc, 0x0b, 0xb8, 0x26, 0x65, 0xba, 0x7d, 0x39, 0x7c, 0x16, 0xc5, 0x07, 0x50, 0x4e, - 0x3b, 0xd2, 0x76, 0x26, 0x72, 0x64, 0x83, 0x57, 0x7f, 0x61, 0xaa, 0x3d, 0xdf, 0xd0, 0xaa, 0x33, - 0xce, 0x35, 0xf3, 0xe4, 0xce, 0xc8, 0x43, 0xa6, 0x74, 0xc6, 0xa4, 0xfe, 0xdb, 0xdd, 0x3f, 0xf9, - 0xcd, 0x29, 0x9c, 0x9c, 0x3a, 0xd6, 0xe3, 0x53, 0xc7, 0xfa, 0xf5, 0xd4, 0xb1, 0xbe, 0x3a, 0x73, - 0x0a, 0x8f, 0xcf, 0x9c, 0xc2, 0x4f, 0x67, 0x4e, 0xe1, 0x93, 0xcd, 0xdc, 0xbe, 0x54, 0x94, 0x8c, - 0xc8, 0x56, 0xfa, 0x79, 0x1e, 0x70, 0x1c, 0xf7, 0x89, 0xc8, 0x7d, 0xd3, 0xab, 0xf5, 0xd9, 0x9d, - 0xd7, 0x9f, 0xce, 0x5b, 0x7f, 0x05, 0x00, 0x00, 0xff, 0xff, 0xa4, 0x46, 0x85, 0x7e, 0xf4, 0x0b, - 0x00, 0x00, + // 926 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x57, 0x5d, 0x6f, 0x23, 0x35, + 0x14, 0xcd, 0x24, 0xdd, 0x2a, 0xb9, 0xcd, 0xb6, 0xdd, 0x61, 0x45, 0x93, 0x08, 0xa5, 0xd9, 0x68, + 0x41, 0xe5, 0xa3, 0x13, 0xba, 0x95, 0x0a, 0x5a, 0xed, 0x03, 0x2d, 0x08, 0x69, 0x05, 0xdd, 0x42, + 0xc2, 0x0a, 0x84, 0x8a, 0x22, 0x27, 0xb6, 0xa6, 0xd6, 0xc6, 0xf6, 0x30, 0xf6, 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 0x6b, 0x13, 0x58, 0x1a, 0xbf, 0x26, 0x6e, 0x4f, 0xe4, 0x19, 0x43, 0x55, + 0x5e, 0x9b, 0x05, 0x95, 0x2e, 0xf3, 0x95, 0x03, 0xe5, 0xe9, 0xfd, 0xcb, 0xbb, 0x80, 0x6b, 0xd2, + 0x4e, 0xb7, 0x2e, 0x87, 0x4f, 0xb3, 0xf8, 0x10, 0xf2, 0xc9, 0x51, 0x76, 0xab, 0x13, 0x39, 0xd2, + 0x8a, 0xad, 0xbc, 0x38, 0x35, 0x3e, 0x52, 0x09, 0xfb, 0x50, 0x1c, 0x39, 0xcc, 0x93, 0x4f, 0xc6, + 0x30, 0x64, 0xca, 0xc9, 0x98, 0x74, 0xfe, 0x76, 0xf6, 0x4e, 0x7e, 0xaf, 0x66, 0x4e, 0x4e, 0xab, + 0xce, 0xe3, 0xd3, 0xaa, 0xf3, 0xdb, 0x69, 0xd5, 0xf9, 0xfa, 0xac, 0x9a, 0x79, 0x7c, 0x56, 0xcd, + 0xfc, 0x7c, 0x56, 0xcd, 0x7c, 0xba, 0x31, 0xd4, 0x68, 0x35, 0x25, 0x27, 0xaa, 0x91, 0x7c, 0xd7, + 0x33, 0x81, 0xa3, 0x1e, 0x91, 0x43, 0x7f, 0x06, 0x74, 0xdf, 0xed, 0xcc, 0x9b, 0x6f, 0xee, 0xcd, + 0xbf, 0x03, 0x00, 0x00, 0xff, 0xff, 0x00, 0x73, 0x2c, 0x3e, 0x2d, 0x0c, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1362,6 +1363,16 @@ func (m *MsgSwapCoinResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + { + size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa return len(dAtA) - i, nil } @@ -1612,6 +1623,8 @@ func (m *MsgSwapCoinResponse) Size() (n int) { } var l int _ = l + l = m.Amount.Size() + n += 1 + l + sovTx(uint64(l)) return n } @@ -2973,6 +2986,39 @@ func (m *MsgSwapCoinResponse) Unmarshal(dAtA []byte) error { return fmt.Errorf("proto: MsgSwapCoinResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) diff --git a/proto/irismod/coinswap/tx.proto b/proto/irismod/coinswap/tx.proto index a2c1e8fe..9735808e 100644 --- a/proto/irismod/coinswap/tx.proto +++ b/proto/irismod/coinswap/tx.proto @@ -140,7 +140,9 @@ message MsgSwapOrder { } // MsgSwapCoinResponse defines the Msg/SwapCoin response type -message MsgSwapCoinResponse {} +message MsgSwapCoinResponse { + cosmos.base.v1beta1.Coin amount = 1 [ (gogoproto.nullable) = false ]; +} // MsgUpdateParams is the Msg/UpdateParams request type. //