Skip to content

Commit

Permalink
Merge pull request #11734 from vegaprotocol/division-by-zero
Browse files Browse the repository at this point in the history
fix: division by zero fix
  • Loading branch information
EVODelavega authored Oct 9, 2024
2 parents 2a40697 + 8391227 commit df52e26
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
- [11696](https://github.com/vegaprotocol/vega/issues/11696) - Add binding for estimate fees API.
- [11699](https://github.com/vegaprotocol/vega/issues/11699) - Update factors of programs when they are updated.
- [11724](https://github.com/vegaprotocol/vega/issues/11724) - Allow nil initial time in time trigger.
- [11733](https://github.com/vegaprotocol/vega/issues/11733) - Fix division by zero.

## 0.78.2

Expand Down
2 changes: 1 addition & 1 deletion core/execution/common/market_activity_tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -1427,7 +1427,7 @@ func (mt *marketTracker) processNotionalEndOfEpoch(epochStartTime time.Time, end
for party, twNotional := range mt.twNotional {
tn := int64(endEpochTime.Sub(twNotional.t).Seconds()) * scalingFactor
var notional *num.Uint
if mt.markPrice != nil && !mt.markPrice.IsZero() {
if mt.markPrice != nil && !mt.markPrice.IsZero() && twNotional.price != nil && !twNotional.price.IsZero() {
notional, _ = num.UintFromDecimal(twNotional.notional.ToDecimal().Div(twNotional.price.ToDecimal()).Mul(mt.markPrice.ToDecimal()))
} else {
notional = twNotional.notional
Expand Down

0 comments on commit df52e26

Please sign in to comment.