Skip to content

Commit

Permalink
Merge branch 'develop' into 11399-reduce-logs
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyletang authored Jul 10, 2024
2 parents a17e277 + 244a187 commit 1ed6a84
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion commands/proposal_submission.go
Original file line number Diff line number Diff line change
Expand Up @@ -1283,7 +1283,7 @@ func checkNewFuture(future *protoTypes.FutureProduct, tickSize string) Errors {
tick = num.UintOne()
}
mp, err := num.UintFromString(future.Cap.MaxPrice, 10)
if err {
if err || mp.IsZero() {
errs.AddForProperty("new_market.changes.instrument.product.future.cap.max_price", ErrMustBePositive)
} else if !mp.Mod(mp, tick).IsZero() {
errs.AddForProperty("new_market.changes.instrument.product.future.cap.max_price", ErrMaxPriceMustRespectTickSize)
Expand Down
21 changes: 21 additions & 0 deletions commands/proposal_submission_new_market_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -938,6 +938,27 @@ func testNewCappedMarketWithoutMaxPriceFails(t *testing.T) {
nmConf.TickSize = "10"
err = checkProposalSubmission(cmd)
assert.Contains(t, err.Get("proposal_submission.terms.change.new_market.changes.instrument.product.future.cap.max_price"), commands.ErrMaxPriceMustRespectTickSize)

// submit with no max price but other fields set (0019-MCAL-170)
fCap.MaxPrice = ""
fCap.BinarySettlement = ptr.From(true)
fCap.FullyCollateralised = nil
err = checkProposalSubmission(cmd)
assert.Contains(t, err.Get("proposal_submission.terms.change.new_market.changes.instrument.product.future.cap.max_price"), commands.ErrIsRequired)

// submit with no max price but other fields set (0019-MCAL-171)
fCap.MaxPrice = ""
fCap.BinarySettlement = nil
fCap.FullyCollateralised = ptr.From(true)
err = checkProposalSubmission(cmd)
assert.Contains(t, err.Get("proposal_submission.terms.change.new_market.changes.instrument.product.future.cap.max_price"), commands.ErrIsRequired)

// max cap of zero is rejected
fCap.MaxPrice = "0"
fCap.BinarySettlement = nil
fCap.FullyCollateralised = ptr.From(true)
err = checkProposalSubmission(cmd)
assert.Contains(t, err.Get("proposal_submission.terms.change.new_market.changes.instrument.product.future.cap.max_price"), commands.ErrMustBePositive)
}

func testNewMarketChangeSubmissionWithoutPriceMonitoringSucceeds(t *testing.T) {
Expand Down

0 comments on commit 1ed6a84

Please sign in to comment.