Skip to content

Commit

Permalink
Merge branch 'develop' into 11285
Browse files Browse the repository at this point in the history
  • Loading branch information
ze97286 authored May 18, 2024
2 parents 46a6311 + 51793e7 commit 3eaba98
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@

- [11066](https://github.com/vegaprotocol/vega/issues/11066) - Ensure vesting statistics match vesting accounts numbers.
- [11279](https://github.com/vegaprotocol/vega/issues/11279) - Handle properly the case of multiple transfers for the same game id.

- [11279](https://github.com/vegaprotocol/vega/issues/11279) - Handle properly the case of multiple transfers for the same game id.
- [11293](https://github.com/vegaprotocol/vega/issues/11293) - Panic in data node with position estimate endpoint.

## 0.76.1

Expand Down
2 changes: 1 addition & 1 deletion core/datasource/external/ethcall/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ func (e *Engine) Poll(ctx context.Context, wallTime time.Time) {
if call.triggered(prevEthBlock, nextEthBlockIsh) {
res, err := call.Call(ctx, e.client, nextEthBlock.Number.Uint64())
if err != nil {
e.log.Error("failed to call contract", logging.Error(err), logging.Uint64("chain-id", e.chainID.Load()))
e.log.Error("failed to call contract", logging.Error(err), logging.String("spec-id", specID), logging.Uint64("chain-id", e.chainID.Load()))
event := makeErrorChainEvent(err.Error(), specID, nextEthBlockIsh, e.chainID.Load())
e.forwarder.ForwardFromSelf(event)
e.lastSent = nextEthBlockIsh
Expand Down
17 changes: 9 additions & 8 deletions datanode/api/trading_data_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -3200,8 +3200,8 @@ func (t *TradingDataServiceV2) scaleFromMarketToAssetPrice(
if err != nil {
return nil, err
}

return price.Mul(price, priceFactor), nil
price, _ = num.UintFromDecimal(price.ToDecimal().Mul(priceFactor))
return price, nil
}

func (t *TradingDataServiceV2) scaleDecimalFromMarketToAssetPrice(
Expand All @@ -3219,22 +3219,23 @@ func (t *TradingDataServiceV2) scaleDecimalFromAssetToMarketPrice(
func (t *TradingDataServiceV2) getMarketPriceFactor(
ctx context.Context,
mkt entities.Market,
) (*num.Uint, error) {
) (num.Decimal, error) {
assetID, err := mkt.ToProto().GetAsset()
if err != nil {
return nil, errors.Wrap(err, "getting asset from market")
return num.DecimalZero(), errors.Wrap(err, "getting asset from market")
}

asset, err := t.AssetService.GetByID(ctx, assetID)
if err != nil {
return nil, errors.Wrapf(ErrAssetServiceGetByID, "assetID: %s", assetID)
return num.DecimalZero(), errors.Wrapf(ErrAssetServiceGetByID, "assetID: %s", assetID)
}

// scale the price if needed
// price is expected in market decimal
priceFactor := num.NewUint(1)
priceFactor := num.DecimalOne()
// this could be negative, use decimal
if exp := asset.Decimals - mkt.DecimalPlaces; exp != 0 {
priceFactor.Exp(num.NewUint(10), num.NewUint(uint64(exp)))
priceFactor = num.DecimalFromInt64(10).Pow(num.DecimalFromInt64(int64(exp)))
}
return priceFactor, nil
}
Expand Down Expand Up @@ -3460,7 +3461,7 @@ func (t *TradingDataServiceV2) EstimatePosition(ctx context.Context, req *v2.Est
return nil, err
}

dPriceFactor := priceFactor.ToDecimal()
dPriceFactor := priceFactor

buyOrders := make([]*risk.OrderInfo, 0, len(req.Orders))
sellOrders := make([]*risk.OrderInfo, 0, len(req.Orders))
Expand Down

0 comments on commit 3eaba98

Please sign in to comment.