Skip to content

Commit

Permalink
Merge pull request #11403 from vegaprotocol/fix-fully-collateralised-…
Browse files Browse the repository at this point in the history
…flag

fix: ensure fully collateralised is set correctly
  • Loading branch information
EVODelavega authored Jun 21, 2024
2 parents 6358824 + d85808e commit b634ddb
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions core/governance/market.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,10 @@ func buildMarketFromProposal(
}
makerFeeDec, _ := num.DecimalFromString(makerFee)
infraFeeDec, _ := num.DecimalFromString(infraFee)
// assign here, we want to update this after assigning market variable
marginCalc := &types.MarginCalculator{
ScalingFactors: types.ScalingFactorsFromProto(&scalingFactors),
}
market := &types.Market{
ID: marketID,
DecimalPlaces: definition.Changes.DecimalPlaces,
Expand All @@ -265,10 +269,8 @@ func buildMarketFromProposal(
Duration: int64(openingAuctionDuration.Seconds()),
},
TradableInstrument: &types.TradableInstrument{
Instrument: instrument,
MarginCalculator: &types.MarginCalculator{
ScalingFactors: types.ScalingFactorsFromProto(&scalingFactors),
},
Instrument: instrument,
MarginCalculator: marginCalc,
},
PriceMonitoringSettings: &types.PriceMonitoringSettings{
Parameters: definition.Changes.PriceMonitoringParameters,
Expand All @@ -282,6 +284,9 @@ func buildMarketFromProposal(
TickSize: definition.Changes.TickSize,
EnableTxReordering: definition.Changes.EnableTxReordering,
}
if fCap := market.TradableInstrument.Instrument.Product.Cap(); fCap != nil {
marginCalc.FullyCollateralised = fCap.FullyCollateralised
}
// successor proposal
if suc := definition.Successor(); suc != nil {
market.ParentMarketID = suc.ParentID
Expand Down

0 comments on commit b634ddb

Please sign in to comment.