Skip to content

Commit 60804d2

Browse files
committed
chore: rename height to spot_price_height in asset
1 parent 3861011 commit 60804d2

File tree

5 files changed

+67
-66
lines changed

5 files changed

+67
-66
lines changed

proto/sentinel/oracle/v1/asset.proto

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ message Asset {
1414
int64 decimals = 2;
1515
osmosis.protorev.v1beta1.QueryGetProtoRevPoolRequest proto_rev_pool_request = 3 [(gogoproto.nullable) = false];
1616
osmosis.poolmanager.v1beta1.SpotPriceRequest spot_price_request = 4 [(gogoproto.nullable) = false];
17-
int64 height = 5;
18-
string spot_price = 6 [
17+
string spot_price = 5 [
1918
(gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
2019
(gogoproto.nullable) = false
2120
];
21+
int64 spot_price_height = 6;
2222
}

x/oracle/keeper/msg_handler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ func (k *Keeper) HandleMsgCreateAsset(ctx sdk.Context, msg *v1.MsgCreateAssetReq
2727
Decimals: msg.Decimals,
2828
ProtoRevPoolRequest: msg.ProtoRevPoolRequest,
2929
SpotPriceRequest: msg.SpotPriceRequest,
30-
Height: 0,
3130
SpotPrice: sdkmath.LegacyZeroDec(),
31+
SpotPriceHeight: 0,
3232
}
3333

3434
k.SetAsset(ctx, asset)

x/oracle/keeper/relay.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ func (k *Keeper) OnAcknowledgementPacket(
116116
// handleSpotPriceQueryResponse handles the response for the SpotPrice query.
117117
func (k *Keeper) handleSpotPriceQueryResponse(ctx sdk.Context, asset v1.Asset, resp *abcitypes.ResponseQuery) error {
118118
// Skip updates if the response height is older than the current asset height.
119-
if resp.GetHeight() < asset.Height {
119+
if resp.GetHeight() < asset.SpotPriceHeight {
120120
return nil
121121
}
122122

@@ -146,8 +146,8 @@ func (k *Keeper) handleSpotPriceQueryResponse(ctx sdk.Context, asset v1.Asset, r
146146
}
147147

148148
// Update the asset price using the spot price and its multiplier.
149-
asset.Height = resp.GetHeight()
150149
asset.SpotPrice = spotPrice.MulInt(asset.Multiplier())
150+
asset.SpotPriceHeight = resp.GetHeight()
151151

152152
// Persist the updated asset information in the store.
153153
k.SetAsset(ctx, asset)

x/oracle/types/v1/asset.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,6 @@ func (a *Asset) Validate() error {
7070
return errors.New("base_asset_denom and quote_asset_denom cannot be the same")
7171
}
7272

73-
if a.Height < 0 {
74-
return errors.New("height cannot be negative")
75-
}
76-
7773
if a.SpotPrice.IsNil() {
7874
return errors.New("spot_price cannot be nil")
7975
}
@@ -82,5 +78,9 @@ func (a *Asset) Validate() error {
8278
return errors.New("spot_price cannot be negative")
8379
}
8480

81+
if a.SpotPriceHeight < 0 {
82+
return errors.New("spot_price_height cannot be negative")
83+
}
84+
8585
return nil
8686
}

x/oracle/types/v1/asset.pb.go

Lines changed: 58 additions & 57 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)