diff --git a/proto/ojo/gmp/v1/tx.proto b/proto/ojo/gmp/v1/tx.proto index 96838445..84b50d0a 100644 --- a/proto/ojo/gmp/v1/tx.proto +++ b/proto/ojo/gmp/v1/tx.proto @@ -34,7 +34,7 @@ message MsgSetParams { // MsgSetParamsResponse defines the SetParams response type. message MsgSetParamsResponse {} -// MsgRelay defines the Relay message type. +// MsgRelayPrice defines the Relay message type. message MsgRelayPrice { option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; @@ -57,7 +57,16 @@ message MsgRelayPrice { (gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; + + // resolve_price determines the time that the user wants to resolve the price to. + int64 resolve_time = 6; + + // id determines the id of the price that the user wants to pass. + int64 id = 7; + + // disable_resolve determines whether the user wants to resolve the price or not. + bool disable_resolve = 8; } -// MsgRelay defines the Relay response type. +// MsgRelayPriceResponse defines the Relay response type. message MsgRelayPriceResponse {} diff --git a/x/gmp/keeper/msg_server.go b/x/gmp/keeper/msg_server.go index 015cdf72..68138290 100644 --- a/x/gmp/keeper/msg_server.go +++ b/x/gmp/keeper/msg_server.go @@ -67,10 +67,8 @@ func (ms msgServer) RelayPrice( priceFeed, err := types.NewPriceFeedData( denom, rate, - // TODO: replace with actual resolve time & id - // Ref: https://github.com/ojo-network/ojo/issues/309 - big.NewInt(1), - big.NewInt(1), + big.NewInt(msg.ResolveTime), + big.NewInt(msg.Id), ) if err != nil { ms.keeper.Logger(ctx).With(err).Error("unable to relay price to gmp") @@ -80,9 +78,7 @@ func (ms msgServer) RelayPrice( rates = append(rates, priceFeed) } - // TODO: fill with actual disableResolve option - // Ref: https://github.com/ojo-network/ojo/issues/309 - payload, err := types.EncodeABI("postPrices", rates, false) + payload, err := types.EncodeABI("postPrices", rates, msg.DisableResolve) if err != nil { return nil, err } diff --git a/x/gmp/types/tx.pb.go b/x/gmp/types/tx.pb.go index 0a76adcb..f5ed5795 100644 --- a/x/gmp/types/tx.pb.go +++ b/x/gmp/types/tx.pb.go @@ -121,6 +121,12 @@ type MsgRelayPrice struct { Denoms []string `protobuf:"bytes,4,rep,name=denoms,proto3" json:"denoms,omitempty"` // token determines the IBC token that the user wants to relay via GMP. Token types.Coin `protobuf:"bytes,5,opt,name=token,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"token"` + // resolve_price determines the time that the user wants to resolve the price to. + ResolveTime int64 `protobuf:"varint,6,opt,name=resolve_time,json=resolveTime,proto3" json:"resolve_time,omitempty"` + // id determines the id of the price that the user wants to pass. + Id int64 `protobuf:"varint,7,opt,name=id,proto3" json:"id,omitempty"` + // disable_resolve determines whether the user wants to resolve the price or not. + DisableResolve bool `protobuf:"varint,8,opt,name=disable_resolve,json=disableResolve,proto3" json:"disable_resolve,omitempty"` } func (m *MsgRelayPrice) Reset() { *m = MsgRelayPrice{} } @@ -156,7 +162,7 @@ func (m *MsgRelayPrice) XXX_DiscardUnknown() { var xxx_messageInfo_MsgRelayPrice proto.InternalMessageInfo -// MsgRelay defines the Relay response type. +// MsgRelayPriceResponse defines the Relay response type. type MsgRelayPriceResponse struct { } @@ -203,39 +209,43 @@ func init() { func init() { proto.RegisterFile("ojo/gmp/v1/tx.proto", fileDescriptor_5f28b599a8e3f91d) } var fileDescriptor_5f28b599a8e3f91d = []byte{ - // 509 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x53, 0xb1, 0x6f, 0xd3, 0x4e, - 0x14, 0xb6, 0x9b, 0x5f, 0xf3, 0x53, 0x0e, 0x90, 0xe0, 0x1a, 0x52, 0x27, 0x83, 0x13, 0x32, 0xa0, - 0xa8, 0x28, 0x3e, 0x12, 0x24, 0x86, 0x4e, 0x90, 0x0e, 0x48, 0x48, 0x91, 0x2a, 0x77, 0x63, 0xa9, - 0x2e, 0xf6, 0xe9, 0xe2, 0x04, 0xdf, 0xb3, 0x7c, 0xd7, 0xd0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, 0x98, 0x71, 0x99, 0x21, 0x74, 0x7a, 0xd7, 0x21, 0xa5, 0x20, - 0x7e, 0x8e, 0x90, 0x11, 0x4d, 0xfb, 0x2f, 0x7e, 0x05, 0x75, 0xee, 0x5d, 0x0b, 0x95, 0x5a, 0x93, - 0x27, 0x97, 0x1b, 0xd7, 0xbe, 0xda, 0xb8, 0xf6, 0x8f, 0x8d, 0x6b, 0xbf, 0xdb, 0xba, 0xd6, 0xd5, - 0xd6, 0xb5, 0xbe, 0x6e, 0x5d, 0xeb, 0xc5, 0x7d, 0xc3, 0x16, 0x58, 0xc0, 0x50, 0x30, 0xf5, 0x0a, - 0xd2, 0x65, 0x76, 0x26, 0xe7, 0xf9, 0xc7, 0x92, 0x5b, 0x33, 0xab, 0xe7, 0x7f, 0xec, 0x47, 0xbf, - 0x03, 0x00, 0x00, 0xff, 0xff, 0x63, 0x69, 0x51, 0x3b, 0x7b, 0x03, 0x00, 0x00, + // 565 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x53, 0x31, 0x6f, 0xd3, 0x40, + 0x18, 0xb5, 0x13, 0x9a, 0x36, 0xd7, 0x52, 0xe0, 0x1a, 0x52, 0x27, 0x83, 0xe3, 0x66, 0x00, 0xab, + 0x28, 0x36, 0x09, 0x12, 0x43, 0x27, 0x48, 0x07, 0x24, 0xa4, 0x48, 0x95, 0xcb, 0xc4, 0x12, 0x5d, + 0xe2, 0xd3, 0xe5, 0x92, 0xd8, 0x9f, 0xe5, 0xbb, 0x86, 0x66, 0x65, 0x42, 0x0c, 0x88, 0x99, 0xa9, + 0x33, 0x13, 0x03, 0x3f, 0xa2, 0x63, 0xc5, 0xc4, 0x04, 0x28, 0x19, 0xe0, 0x67, 0x20, 0xdb, 0x17, + 0xc5, 0x20, 0x55, 0x9d, 0x7c, 0xdf, 0x7b, 0xef, 0xde, 0x7d, 0xfe, 0xde, 0x1d, 0xda, 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, 0xdd, 0xff, 0x27, 0x8f, 0x55, 0x52, + 0x9d, 0x4f, 0x3a, 0x2a, 0xf6, 0x04, 0xc3, 0x2f, 0x50, 0x79, 0x7d, 0xa5, 0x8c, 0xfc, 0x55, 0xc8, + 0x07, 0x5c, 0xb7, 0xae, 0x63, 0x56, 0x86, 0xf8, 0x25, 0x42, 0xb9, 0xd8, 0x6b, 0xff, 0xe9, 0xd7, + 0x54, 0xfd, 0xe0, 0x5a, 0x6a, 0xe5, 0xd5, 0x7d, 0x76, 0xb9, 0x30, 0xf5, 0xab, 0x85, 0xa9, 0xff, + 0x5a, 0x98, 0xfa, 0xc7, 0xa5, 0xa9, 0x5d, 0x2d, 0x4d, 0xed, 0xfb, 0xd2, 0xd4, 0x5e, 0x3f, 0xc8, + 0x8d, 0x1c, 0xc6, 0xd0, 0x0a, 0xa9, 0x7c, 0x03, 0xf1, 0x24, 0x59, 0xbb, 0xe7, 0xe9, 0x43, 0x4c, + 0xc7, 0x3e, 0x28, 0xa5, 0x8f, 0xe6, 0xc9, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x5e, 0x27, 0x43, + 0x9c, 0xd7, 0x03, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -443,6 +453,26 @@ func (m *MsgRelayPrice) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.DisableResolve { + i-- + if m.DisableResolve { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x40 + } + if m.Id != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Id)) + i-- + dAtA[i] = 0x38 + } + if m.ResolveTime != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.ResolveTime)) + i-- + dAtA[i] = 0x30 + } { size, err := m.Token.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -572,6 +602,15 @@ func (m *MsgRelayPrice) Size() (n int) { } l = m.Token.Size() n += 1 + l + sovTx(uint64(l)) + if m.ResolveTime != 0 { + n += 1 + sovTx(uint64(m.ResolveTime)) + } + if m.Id != 0 { + n += 1 + sovTx(uint64(m.Id)) + } + if m.DisableResolve { + n += 2 + } return n } @@ -948,6 +987,64 @@ func (m *MsgRelayPrice) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ResolveTime", wireType) + } + m.ResolveTime = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ResolveTime |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + m.Id = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Id |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DisableResolve", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.DisableResolve = bool(v != 0) default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:])