diff --git a/proto/sentinel/oracle/v1/asset.proto b/proto/sentinel/oracle/v1/asset.proto index 4765fc7b..36173e00 100644 --- a/proto/sentinel/oracle/v1/asset.proto +++ b/proto/sentinel/oracle/v1/asset.proto @@ -10,12 +10,11 @@ option (gogoproto.goproto_getters_all) = false; message Asset { string denom = 1; int64 decimals = 2; - uint64 pool_id = 3 [(gogoproto.customname) = "PoolID"]; - string base_asset_denom = 4; - string quote_asset_denom = 5; - string price = 6 [ + string base_asset_denom = 3; + string quote_asset_denom = 4; + string price = 5 [ (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; - int64 height = 7; + int64 height = 6; } diff --git a/x/oracle/keeper/abci.go b/x/oracle/keeper/abci.go index 52ef0a32..11472728 100644 --- a/x/oracle/keeper/abci.go +++ b/x/oracle/keeper/abci.go @@ -5,32 +5,47 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ibchost "github.com/cosmos/ibc-go/v7/modules/core/24-host" + protorevtypes "github.com/sentinel-official/hub/v12/third_party/osmosis/x/protorev/types" "github.com/sentinel-official/hub/v12/x/oracle/types/v1" ) +// EndBlock is called at the end of each block to trigger IBC query packets for relevant assets. func (k *Keeper) EndBlock(ctx sdk.Context) []abcitypes.ValidatorUpdate { + // Retrieve necessary information for the IBC packet. portID := k.GetPortID(ctx) channelID := k.GetChannelID(ctx) timeout := k.GetQueryTimeout(ctx) + // Get the channel capability to ensure we have the authority to send packets. channelCap, found := k.capability.GetCapability(ctx, ibchost.ChannelCapabilityPath(portID, channelID)) if !found { return nil } + // Iterate over each asset and send a ProtoRevPool query for each. k.IterateAssets(ctx, func(_ int, item v1.Asset) bool { - sequence, err := k.SendQueryPacket( - ctx, channelCap, portID, channelID, uint64(timeout), - item.ProtoRevPoolRequest(k.cdc), - item.SpotPriceRequest(k.cdc), - ) + // Create a request for the GetProtoRevPool query using asset details. + req := abcitypes.RequestQuery{ + Data: k.cdc.MustMarshal( + &protorevtypes.QueryGetProtoRevPoolRequest{ + BaseDenom: item.BaseAssetDenom, + OtherDenom: item.QuoteAssetDenom, + }, + ), + Path: "/osmosis.protorev.v1beta1.Query/GetProtoRevPool", + } + + // Send the GetProtoRevPool query packet over IBC. + sequence, err := k.SendQueryPacket(ctx, channelCap, portID, channelID, uint64(timeout), req) if err != nil { panic(err) } + // Map the sequence number to the asset denom for tracking. k.SetDenomForPacket(ctx, portID, channelID, sequence, item.Denom) return false }) + // No validator updates in this function. return nil } diff --git a/x/oracle/keeper/msg_handler.go b/x/oracle/keeper/msg_handler.go index 58742b45..c81416c0 100644 --- a/x/oracle/keeper/msg_handler.go +++ b/x/oracle/keeper/msg_handler.go @@ -21,10 +21,10 @@ func (k *Keeper) HandleMsgCreateAsset(ctx sdk.Context, msg *v1.MsgCreateAssetReq asset := v1.Asset{ Denom: msg.Denom, Decimals: msg.Decimals, - PoolID: 0, BaseAssetDenom: msg.BaseAssetDenom, QuoteAssetDenom: msg.QuoteAssetDenom, Price: sdkmath.ZeroInt(), + Height: 0, } k.SetAsset(ctx, asset) diff --git a/x/oracle/keeper/params.go b/x/oracle/keeper/params.go index 468aab09..30e5e181 100644 --- a/x/oracle/keeper/params.go +++ b/x/oracle/keeper/params.go @@ -45,5 +45,6 @@ func (k *Keeper) GetTimeout(ctx sdk.Context) time.Duration { // GetQueryTimeout returns the current block time adjusted by the module's timeout parameter in Unix nanoseconds. func (k *Keeper) GetQueryTimeout(ctx sdk.Context) int64 { - return ctx.BlockTime().Add(k.GetTimeout(ctx)).UnixNano() + t := k.GetTimeout(ctx) + return ctx.BlockTime().Add(t).UnixNano() } diff --git a/x/oracle/keeper/relay.go b/x/oracle/keeper/relay.go index ac07f99b..d700237d 100644 --- a/x/oracle/keeper/relay.go +++ b/x/oracle/keeper/relay.go @@ -10,9 +10,11 @@ import ( ibcicqtypes "github.com/cosmos/ibc-apps/modules/async-icq/v7/types" ibcclienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" ibcchanneltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" + ibchost "github.com/cosmos/ibc-go/v7/modules/core/24-host" "github.com/sentinel-official/hub/v12/third_party/osmosis/x/poolmanager/client/queryproto" protorevtypes "github.com/sentinel-official/hub/v12/third_party/osmosis/x/protorev/types" + "github.com/sentinel-official/hub/v12/x/oracle/types/v1" ) // SendQueryPacket serializes query requests and sends them as an IBC packet to a destination chain. @@ -39,7 +41,6 @@ func (k *Keeper) SendQueryPacket( } // OnAcknowledgementPacket processes the acknowledgement packet received after sending an IBC query packet. -// It deserializes the packet data and acknowledgement, validates the response count, and updates the relevant asset. func (k *Keeper) OnAcknowledgementPacket( ctx sdk.Context, packet ibcchanneltypes.Packet, ack ibcchanneltypes.Acknowledgement, ) error { @@ -93,40 +94,88 @@ func (k *Keeper) OnAcknowledgementPacket( // Iterate through each request-response pair and update the asset accordingly. for i := 0; i < len(reqs); i++ { - // Skip updates if the response height is older than the current asset height. - if resps[i].GetHeight() < asset.Height { - return nil - } - // Handle specific query paths to extract the required data and update the asset. switch reqs[i].Path { case "/osmosis.poolmanager.v1beta1.Query/SpotPrice": - // Extract the spot price from the response and update the asset price. - var res queryproto.SpotPriceResponse - if err := k.cdc.Unmarshal(resps[i].GetValue(), &res); err != nil { - return err - } - - spotPrice, err := sdkmath.LegacyNewDecFromStr(res.GetSpotPrice()) - if err != nil { + if err := k.handleSpotPriceQueryResponse(ctx, asset, &resps[i]); err != nil { return err } - - // Update the asset price using the spot price and its exponent. - asset.Price = spotPrice.MulInt(asset.Exponent()).TruncateInt() case "/osmosis.protorev.v1beta1.Query/GetProtoRevPool": - // Extract the pool ID from the response and update the asset pool ID. - var res protorevtypes.QueryGetProtoRevPoolResponse - if err := k.cdc.Unmarshal(resps[i].GetValue(), &res); err != nil { + if err := k.handleProtoRevPoolQueryResponse(ctx, asset, &resps[i]); err != nil { return err } - - asset.PoolID = res.GetPoolId() } } + return nil +} + +// handleSpotPriceQueryResponse handles the response for the SpotPrice query. +func (k *Keeper) handleSpotPriceQueryResponse(ctx sdk.Context, asset v1.Asset, resp *abcitypes.ResponseQuery) error { + // Skip updates if the response height is older than the current asset height. + if resp.GetHeight() < asset.Height { + return nil + } + + var res queryproto.SpotPriceResponse + if err := k.cdc.Unmarshal(resp.GetValue(), &res); err != nil { + return err + } + + spotPrice, err := sdkmath.LegacyNewDecFromStr(res.GetSpotPrice()) + if err != nil { + return err + } + + // Update the asset price using the spot price and its multiplier. + asset.Price = spotPrice.MulInt(asset.Multiplier()).TruncateInt() + asset.Height = resp.GetHeight() + // Persist the updated asset information in the store. k.SetAsset(ctx, asset) return nil } + +// handleProtoRevPoolQueryResponse handles the response for the GetProtoRevPool query. +func (k *Keeper) handleProtoRevPoolQueryResponse(ctx sdk.Context, asset v1.Asset, resp *abcitypes.ResponseQuery) error { + // Unmarshal the response to extract the pool ID and other relevant details. + var res protorevtypes.QueryGetProtoRevPoolResponse + if err := k.cdc.Unmarshal(resp.GetValue(), &res); err != nil { + return err + } + + // Retrieve necessary information for sending a follow-up query. + portID := k.GetPortID(ctx) + channelID := k.GetChannelID(ctx) + timeout := k.GetQueryTimeout(ctx) + + // Get the channel capability to ensure we have the authority to send packets. + channelCap, found := k.capability.GetCapability(ctx, ibchost.ChannelCapabilityPath(portID, channelID)) + if !found { + return nil + } + + // Create a new request for the SpotPrice query using the pool ID and asset details. + req := abcitypes.RequestQuery{ + Data: k.cdc.MustMarshal( + &queryproto.SpotPriceRequest{ + PoolId: res.GetPoolId(), + BaseAssetDenom: asset.BaseAssetDenom, + QuoteAssetDenom: asset.QuoteAssetDenom, + }, + ), + Path: "/osmosis.poolmanager.v1beta1.Query/SpotPrice", + } + + // Send the SpotPrice query packet over IBC. + sequence, err := k.SendQueryPacket(ctx, channelCap, portID, channelID, uint64(timeout), req) + if err != nil { + return err + } + + // Map the sequence number to the asset denom for tracking. + k.SetDenomForPacket(ctx, portID, channelID, sequence, asset.Denom) + + return nil +} diff --git a/x/oracle/types/errors.go b/x/oracle/types/errors.go index a8cfeec4..116605b7 100644 --- a/x/oracle/types/errors.go +++ b/x/oracle/types/errors.go @@ -37,7 +37,7 @@ func NewErrorAssetNotFound(denom string) error { } func NewErrorDenomtNotFound(portID, channelID string, sequence uint64) error { - return sdkerrors.Wrapf(ErrorAssetNotFound, "denom for packet %s/%s/%d does not exist", portID, channelID, sequence) + return sdkerrors.Wrapf(ErrorDenomNotFound, "denom for packet %s/%s/%d does not exist", portID, channelID, sequence) } func NewErrorInvalidSigner(from, expected string) error { diff --git a/x/oracle/types/v1/asset.go b/x/oracle/types/v1/asset.go index 615b734d..a2b72715 100644 --- a/x/oracle/types/v1/asset.go +++ b/x/oracle/types/v1/asset.go @@ -5,40 +5,10 @@ import ( "math/big" sdkmath "cosmossdk.io/math" - abcitypes "github.com/cometbft/cometbft/abci/types" - "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/sentinel-official/hub/v12/third_party/osmosis/x/poolmanager/client/queryproto" - protorevtypes "github.com/sentinel-official/hub/v12/third_party/osmosis/x/protorev/types" ) -func (a *Asset) ProtoRevPoolRequest(cdc codec.Codec) abcitypes.RequestQuery { - return abcitypes.RequestQuery{ - Data: cdc.MustMarshal( - &protorevtypes.QueryGetProtoRevPoolRequest{ - BaseDenom: a.BaseAssetDenom, - OtherDenom: a.QuoteAssetDenom, - }, - ), - Path: "/osmosis.protorev.v1beta1.Query/GetProtoRevPool", - } -} - -func (a *Asset) SpotPriceRequest(cdc codec.Codec) abcitypes.RequestQuery { - return abcitypes.RequestQuery{ - Data: cdc.MustMarshal( - &queryproto.SpotPriceRequest{ - PoolId: a.PoolID, - BaseAssetDenom: a.BaseAssetDenom, - QuoteAssetDenom: a.QuoteAssetDenom, - }, - ), - Path: "/osmosis.poolmanager.v1beta1.Query/SpotPrice", - } -} - -func (a *Asset) Exponent() sdkmath.Int { +func (a *Asset) Multiplier() sdkmath.Int { i := new(big.Int).Exp(big.NewInt(10), big.NewInt(a.Decimals), nil) return sdkmath.NewIntFromBigInt(i) } diff --git a/x/oracle/types/v1/asset.pb.go b/x/oracle/types/v1/asset.pb.go index ac4d7b63..c629c938 100644 --- a/x/oracle/types/v1/asset.pb.go +++ b/x/oracle/types/v1/asset.pb.go @@ -27,11 +27,10 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type Asset struct { Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` Decimals int64 `protobuf:"varint,2,opt,name=decimals,proto3" json:"decimals,omitempty"` - PoolID uint64 `protobuf:"varint,3,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` - BaseAssetDenom string `protobuf:"bytes,4,opt,name=base_asset_denom,json=baseAssetDenom,proto3" json:"base_asset_denom,omitempty"` - QuoteAssetDenom string `protobuf:"bytes,5,opt,name=quote_asset_denom,json=quoteAssetDenom,proto3" json:"quote_asset_denom,omitempty"` - Price cosmossdk_io_math.Int `protobuf:"bytes,6,opt,name=price,proto3,customtype=cosmossdk.io/math.Int" json:"price"` - Height int64 `protobuf:"varint,7,opt,name=height,proto3" json:"height,omitempty"` + BaseAssetDenom string `protobuf:"bytes,3,opt,name=base_asset_denom,json=baseAssetDenom,proto3" json:"base_asset_denom,omitempty"` + QuoteAssetDenom string `protobuf:"bytes,4,opt,name=quote_asset_denom,json=quoteAssetDenom,proto3" json:"quote_asset_denom,omitempty"` + Price cosmossdk_io_math.Int `protobuf:"bytes,5,opt,name=price,proto3,customtype=cosmossdk.io/math.Int" json:"price"` + Height int64 `protobuf:"varint,6,opt,name=height,proto3" json:"height,omitempty"` } func (m *Asset) Reset() { *m = Asset{} } @@ -74,29 +73,27 @@ func init() { func init() { proto.RegisterFile("sentinel/oracle/v1/asset.proto", fileDescriptor_7af40c63c75f3887) } var fileDescriptor_7af40c63c75f3887 = []byte{ - // 340 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x91, 0xbb, 0x4e, 0xf3, 0x30, - 0x18, 0x86, 0x93, 0xb6, 0x49, 0xff, 0xdf, 0x03, 0x07, 0xab, 0xa0, 0xa8, 0x12, 0x6e, 0x05, 0x4b, - 0x84, 0x44, 0xac, 0x50, 0x89, 0x9d, 0xaa, 0x4b, 0x37, 0x94, 0x09, 0xb1, 0x54, 0x39, 0xb8, 0x89, - 0x45, 0x92, 0x2f, 0xd4, 0x6e, 0x04, 0x23, 0x77, 0xc0, 0x65, 0x70, 0x29, 0x1d, 0x3b, 0x22, 0x86, - 0x0a, 0xd2, 0x1b, 0x41, 0x71, 0x28, 0x82, 0xcd, 0xaf, 0x9f, 0xc7, 0x7a, 0xed, 0xcf, 0x88, 0x08, - 0x96, 0x4b, 0x9e, 0xb3, 0x94, 0xc2, 0xc2, 0x0f, 0x53, 0x46, 0x4b, 0x97, 0xfa, 0x42, 0x30, 0xe9, - 0x14, 0x0b, 0x90, 0x80, 0xf1, 0x8e, 0x3b, 0x0d, 0x77, 0x4a, 0xb7, 0xdf, 0x8b, 0x21, 0x06, 0x85, - 0x69, 0xbd, 0x6a, 0xcc, 0xd3, 0xe7, 0x16, 0x32, 0xae, 0xeb, 0x93, 0xb8, 0x87, 0x8c, 0x88, 0xe5, - 0x90, 0x59, 0xfa, 0x50, 0xb7, 0xff, 0x7b, 0x4d, 0xc0, 0x7d, 0xf4, 0x2f, 0x62, 0x21, 0xcf, 0xfc, - 0x54, 0x58, 0xad, 0xa1, 0x6e, 0xb7, 0xbd, 0x9f, 0x8c, 0xcf, 0x50, 0xb7, 0x00, 0x48, 0x67, 0x3c, - 0xb2, 0xda, 0x43, 0xdd, 0xee, 0x8c, 0x51, 0xb5, 0x19, 0x98, 0x37, 0x00, 0xe9, 0x74, 0xe2, 0x99, - 0x35, 0x9a, 0x46, 0xd8, 0x46, 0x07, 0x81, 0x2f, 0xd8, 0x4c, 0x5d, 0x6f, 0xd6, 0x34, 0x74, 0x54, - 0xc3, 0x5e, 0xbd, 0xaf, 0xba, 0x27, 0xaa, 0xea, 0x1c, 0x1d, 0x3e, 0x2c, 0x41, 0xfe, 0x55, 0x0d, - 0xa5, 0xee, 0x2b, 0xf0, 0xcb, 0x1d, 0x21, 0xa3, 0x58, 0xf0, 0x90, 0x59, 0x66, 0xcd, 0xc7, 0x27, - 0xab, 0xcd, 0x40, 0x7b, 0xdf, 0x0c, 0x8e, 0x42, 0x10, 0x19, 0x08, 0x11, 0xdd, 0x3b, 0x1c, 0x68, - 0xe6, 0xcb, 0xc4, 0x99, 0xe6, 0xd2, 0x6b, 0x5c, 0x7c, 0x8c, 0xcc, 0x84, 0xf1, 0x38, 0x91, 0x56, - 0x57, 0xbd, 0xe4, 0x3b, 0x8d, 0x6f, 0x57, 0x9f, 0x44, 0x7b, 0xad, 0x88, 0xb6, 0xaa, 0x88, 0xbe, - 0xae, 0x88, 0xfe, 0x51, 0x11, 0xfd, 0x65, 0x4b, 0xb4, 0xf5, 0x96, 0x68, 0x6f, 0x5b, 0xa2, 0xdd, - 0x5d, 0xc5, 0x5c, 0x26, 0xcb, 0xc0, 0x09, 0x21, 0xa3, 0xbb, 0xd1, 0x5e, 0xc0, 0x7c, 0xce, 0x43, - 0xee, 0xa7, 0x34, 0x59, 0x06, 0xb4, 0x74, 0x2f, 0xe9, 0xe3, 0xee, 0x37, 0xe4, 0x53, 0xc1, 0x04, - 0x2d, 0xdd, 0xc0, 0x54, 0x43, 0x1e, 0x7d, 0x05, 0x00, 0x00, 0xff, 0xff, 0x76, 0x0a, 0x14, 0xf2, - 0xb0, 0x01, 0x00, 0x00, + // 310 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x90, 0x4f, 0x4b, 0xfb, 0x30, + 0x18, 0xc7, 0x9b, 0xdf, 0x7e, 0x1d, 0x9a, 0x83, 0x7f, 0xc2, 0x94, 0x32, 0x30, 0x1b, 0x9e, 0x86, + 0x60, 0x42, 0x1d, 0x78, 0x77, 0x78, 0xf1, 0xba, 0x93, 0x78, 0x19, 0x69, 0x96, 0xb5, 0xc1, 0xb6, + 0xcf, 0x5c, 0xb2, 0xa2, 0xef, 0xc2, 0x97, 0xe1, 0x4b, 0xd9, 0x71, 0x47, 0x11, 0x19, 0xda, 0xbd, + 0x11, 0x69, 0x6a, 0x45, 0x6f, 0x79, 0xf2, 0xf9, 0x7c, 0x9f, 0x84, 0x2f, 0xa6, 0x46, 0xe5, 0x56, + 0xe7, 0x2a, 0xe5, 0xb0, 0x10, 0x32, 0x55, 0xbc, 0x08, 0xb9, 0x30, 0x46, 0x59, 0x36, 0x5f, 0x80, + 0x05, 0x42, 0x1a, 0xce, 0x6a, 0xce, 0x8a, 0xb0, 0xdb, 0x89, 0x21, 0x06, 0x87, 0x79, 0x75, 0xaa, + 0xcd, 0xd3, 0x77, 0x84, 0xfd, 0xab, 0x2a, 0x49, 0x3a, 0xd8, 0x9f, 0xaa, 0x1c, 0xb2, 0x00, 0xf5, + 0xd1, 0x60, 0x77, 0x5c, 0x0f, 0xa4, 0x8b, 0x77, 0xa6, 0x4a, 0xea, 0x4c, 0xa4, 0x26, 0xf8, 0xd7, + 0x47, 0x83, 0xd6, 0xf8, 0x67, 0x26, 0x03, 0x7c, 0x10, 0x09, 0xa3, 0x26, 0xee, 0xe5, 0x49, 0x1d, + 0x6e, 0xb9, 0xf0, 0x5e, 0x75, 0xef, 0xd6, 0x5e, 0xbb, 0x2d, 0x67, 0xf8, 0xf0, 0x61, 0x09, 0xf6, + 0xaf, 0xfa, 0xdf, 0xa9, 0xfb, 0x0e, 0xfc, 0x72, 0x87, 0xd8, 0x9f, 0x2f, 0xb4, 0x54, 0x81, 0x5f, + 0xf1, 0xd1, 0xc9, 0x6a, 0xd3, 0xf3, 0xde, 0x36, 0xbd, 0x23, 0x09, 0x26, 0x03, 0x63, 0xa6, 0xf7, + 0x4c, 0x03, 0xcf, 0x84, 0x4d, 0xd8, 0x4d, 0x6e, 0xc7, 0xb5, 0x4b, 0x8e, 0x71, 0x3b, 0x51, 0x3a, + 0x4e, 0x6c, 0xd0, 0x76, 0x9f, 0xfc, 0x9e, 0x46, 0xb7, 0xab, 0x4f, 0xea, 0xbd, 0x94, 0xd4, 0x5b, + 0x95, 0x14, 0xad, 0x4b, 0x8a, 0x3e, 0x4a, 0x8a, 0x9e, 0xb7, 0xd4, 0x5b, 0x6f, 0xa9, 0xf7, 0xba, + 0xa5, 0xde, 0xdd, 0x65, 0xac, 0x6d, 0xb2, 0x8c, 0x98, 0x84, 0x8c, 0x37, 0xad, 0x9d, 0xc3, 0x6c, + 0xa6, 0xa5, 0x16, 0x29, 0x4f, 0x96, 0x11, 0x2f, 0xc2, 0x0b, 0xfe, 0xd8, 0x14, 0x6d, 0x9f, 0xe6, + 0xca, 0xf0, 0x22, 0x8c, 0xda, 0xae, 0xbf, 0xe1, 0x57, 0x00, 0x00, 0x00, 0xff, 0xff, 0x87, 0x88, + 0x5f, 0x39, 0x8b, 0x01, 0x00, 0x00, } func (m *Asset) Marshal() (dAtA []byte, err error) { @@ -122,7 +119,7 @@ func (m *Asset) MarshalToSizedBuffer(dAtA []byte) (int, error) { if m.Height != 0 { i = encodeVarintAsset(dAtA, i, uint64(m.Height)) i-- - dAtA[i] = 0x38 + dAtA[i] = 0x30 } { size := m.Price.Size() @@ -133,25 +130,20 @@ func (m *Asset) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintAsset(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x32 + dAtA[i] = 0x2a if len(m.QuoteAssetDenom) > 0 { i -= len(m.QuoteAssetDenom) copy(dAtA[i:], m.QuoteAssetDenom) i = encodeVarintAsset(dAtA, i, uint64(len(m.QuoteAssetDenom))) i-- - dAtA[i] = 0x2a + dAtA[i] = 0x22 } if len(m.BaseAssetDenom) > 0 { i -= len(m.BaseAssetDenom) copy(dAtA[i:], m.BaseAssetDenom) i = encodeVarintAsset(dAtA, i, uint64(len(m.BaseAssetDenom))) i-- - dAtA[i] = 0x22 - } - if m.PoolID != 0 { - i = encodeVarintAsset(dAtA, i, uint64(m.PoolID)) - i-- - dAtA[i] = 0x18 + dAtA[i] = 0x1a } if m.Decimals != 0 { i = encodeVarintAsset(dAtA, i, uint64(m.Decimals)) @@ -192,9 +184,6 @@ func (m *Asset) Size() (n int) { if m.Decimals != 0 { n += 1 + sovAsset(uint64(m.Decimals)) } - if m.PoolID != 0 { - n += 1 + sovAsset(uint64(m.PoolID)) - } l = len(m.BaseAssetDenom) if l > 0 { n += 1 + l + sovAsset(uint64(l)) @@ -298,25 +287,6 @@ func (m *Asset) Unmarshal(dAtA []byte) error { } } case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field PoolID", wireType) - } - m.PoolID = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAsset - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.PoolID |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field BaseAssetDenom", wireType) } @@ -348,7 +318,7 @@ func (m *Asset) Unmarshal(dAtA []byte) error { } m.BaseAssetDenom = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 5: + case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field QuoteAssetDenom", wireType) } @@ -380,7 +350,7 @@ func (m *Asset) Unmarshal(dAtA []byte) error { } m.QuoteAssetDenom = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 6: + case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Price", wireType) } @@ -414,7 +384,7 @@ func (m *Asset) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 7: + case 6: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) }