Skip to content

Commit

Permalink
get rid of integer conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
leonz789 committed Apr 18, 2024
1 parent 2ef42cd commit a723d1a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
bou.ke/monkey v1.0.2 h1:kWcnsrCNUatbxncxR/ThdYqbytgOIArtYWqcQLQzKLI=
bou.ke/monkey v1.0.2/go.mod h1:OqickVX3tNx6t33n1xvtTtu85YN5s6cKwVug+oHMaIA=
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU=
Expand Down
8 changes: 4 additions & 4 deletions x/oracle/keeper/msg_server_create_price.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ func (ms msgServer) CreatePrice(goCtx context.Context, msg *types.MsgCreatePrice

ctx.EventManager().EmitEvent(sdk.NewEvent(
types.EventTypeCreatePrice,
sdk.NewAttribute(types.AttributeKeyFeederID, strconv.Itoa(int(msg.FeederID))),
sdk.NewAttribute(types.AttributeKeyBasedBlock, strconv.FormatInt(int64(msg.BasedBlock), 10)),
sdk.NewAttribute(types.AttributeKeyFeederID, strconv.FormatUint(msg.FeederID, 10)),
sdk.NewAttribute(types.AttributeKeyBasedBlock, strconv.FormatUint(msg.BasedBlock, 10)),
sdk.NewAttribute(types.AttributeKeyProposer, msg.Creator),
),
)
Expand All @@ -36,8 +36,8 @@ func (ms msgServer) CreatePrice(goCtx context.Context, msg *types.MsgCreatePrice

ctx.EventManager().EmitEvent(sdk.NewEvent(
types.EventTypeCreatePrice,
sdk.NewAttribute(types.AttributeKeyFeederID, strconv.Itoa(int(msg.FeederID))),
sdk.NewAttribute(types.AttributeKeyRoundID, strconv.FormatInt(int64(newItem.PriceTR.RoundID), 10)),
sdk.NewAttribute(types.AttributeKeyFeederID, strconv.FormatUint(msg.FeederID, 10)),
sdk.NewAttribute(types.AttributeKeyRoundID, strconv.FormatUint(newItem.PriceTR.RoundID, 10)),
sdk.NewAttribute(types.AttributeKeyFinalPrice, newItem.PriceTR.Price),
sdk.NewAttribute(types.AttributeKeyPriceUpdated, types.AttributeValuePriceUpdatedSuccess),
),
Expand Down
6 changes: 3 additions & 3 deletions x/oracle/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.Val
for _, tokenID := range failed {
event := sdk.NewEvent(
types.EventTypeCreatePrice,
sdk.NewAttribute(types.AttributeKeyTokenID, strconv.Itoa(int(tokenID))),
sdk.NewAttribute(types.AttributeKeyTokenID, strconv.FormatUint(tokenID, 10)),
sdk.NewAttribute(types.AttributeKeyPriceUpdated, types.AttributeValuePriceUpdatedFail),
)
logInfo := fmt.Sprintf("add new round with previous price under fail aggregation, tokenID:%d", tokenID)
Expand All @@ -192,7 +192,7 @@ func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.Val
logger.Info("add new round with previous price under fail aggregation", "tokenID", tokenID, "roundID", pTR.RoundID)
logInfo += fmt.Sprintf(", roundID:%d, price:%s", pTR.RoundID, pTR.Price)
event.AppendAttributes(
sdk.NewAttribute(types.AttributeKeyRoundID, strconv.Itoa(int(pTR.RoundID))),
sdk.NewAttribute(types.AttributeKeyRoundID, strconv.FormatUint(pTR.RoundID, 10)),
sdk.NewAttribute(types.AttributeKeyFinalPrice, pTR.Price),
)
} else {
Expand All @@ -202,7 +202,7 @@ func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.Val
})
logInfo += fmt.Sprintf(", roundID:%d, price:-", nextRoundID)
event.AppendAttributes(
sdk.NewAttribute(types.AttributeKeyRoundID, strconv.Itoa(int(nextRoundID))),
sdk.NewAttribute(types.AttributeKeyRoundID, strconv.FormatUint(nextRoundID, 10)),
sdk.NewAttribute(types.AttributeKeyFinalPrice, "-"),
)
}
Expand Down

0 comments on commit a723d1a

Please sign in to comment.