Skip to content

Commit

Permalink
Merge pull request #11539 from vegaprotocol/fix_spot_spam_bug
Browse files Browse the repository at this point in the history
fix: order spam check for spot fixed
  • Loading branch information
jeremyletang committed Aug 8, 2024
1 parent 3783232 commit 04d7de0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@
- [](https://github.com/vegaprotocol/vega/issues/xxx)


## 0.77.7

### 🐛 Fixes

- [11540](https://github.com/vegaprotocol/vega/issues/11540) - Fix spam check for spots to use not double count quantum.


## 0.77.6

### 🐛 Fixes
Expand Down
3 changes: 1 addition & 2 deletions core/execution/spot/market.go
Original file line number Diff line number Diff line change
Expand Up @@ -3346,10 +3346,9 @@ func (m *Market) checkOrderForSpam(side types.Side, orderPrice *num.Uint, orderS
price, _ = num.UintFromDecimal(orderPrice.ToDecimal().Mul(m.priceFactor))
}

minQuantum := assetQuantum.Mul(quantumMultiplier)
value := num.UintZero().Mul(num.NewUint(orderSize), price).ToDecimal()
value = value.Div(m.positionFactor)
required := minQuantum.Mul(assetQuantum)
required := assetQuantum.Mul(quantumMultiplier)
if value.LessThan(required) {
return fmt.Errorf(fmt.Sprintf("order value (%s) is less than minimum holding requirement for spam (%s)", value.String(), required.String()))
}
Expand Down

0 comments on commit 04d7de0

Please sign in to comment.