diff --git a/core/governance/market.go b/core/governance/market.go index 59b89860a7..cbead25e66 100644 --- a/core/governance/market.go +++ b/core/governance/market.go @@ -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, @@ -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, @@ -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