code.vegaprotocol.io/vega@v0.79.0/core/integration/steps/market/market_config.go (about)

     1  // Copyright (C) 2023 Gobalsky Labs Limited
     2  //
     3  // This program is free software: you can redistribute it and/or modify
     4  // it under the terms of the GNU Affero General Public License as
     5  // published by the Free Software Foundation, either version 3 of the
     6  // License, or (at your option) any later version.
     7  //
     8  // This program is distributed in the hope that it will be useful,
     9  // but WITHOUT ANY WARRANTY; without even the implied warranty of
    10  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    11  // GNU Affero General Public License for more details.
    12  //
    13  // You should have received a copy of the GNU Affero General Public License
    14  // along with this program.  If not, see <http://www.gnu.org/licenses/>.
    15  
    16  package market
    17  
    18  import (
    19  	"code.vegaprotocol.io/vega/core/integration/steps/market/defaults"
    20  	"code.vegaprotocol.io/vega/libs/num"
    21  )
    22  
    23  type Config struct {
    24  	RiskModels          *riskModels
    25  	FeesConfig          *feesConfig
    26  	OracleConfigs       *oracleConfigs
    27  	PriceMonitoring     *priceMonitoring
    28  	MarginCalculators   *marginCalculators
    29  	LiquidityMonitoring *liquidityMonitoring
    30  	LiquiditySLAParams  *slaParams
    31  	LiquidationStrat    *liquidationConfig
    32  }
    33  
    34  type SuccessorConfig struct {
    35  	ParentID            string
    36  	InsuranceFraction   num.Decimal
    37  	PriceMonitoring     *priceMonitoring
    38  	LiquidityMonitoring *liquidityMonitoring
    39  	RiskModels          *riskModels
    40  	PositionDecimals    int64
    41  	Decimals            uint64
    42  	PriceRange          num.Decimal
    43  	LinSlip             num.Decimal
    44  	QuadSlip            num.Decimal
    45  	LiquidationStrat    *liquidationConfig
    46  }
    47  
    48  func NewMarketConfig() *Config {
    49  	unmarshaler := defaults.NewUnmarshaler()
    50  	return &Config{
    51  		RiskModels:          newRiskModels(unmarshaler),
    52  		FeesConfig:          newFeesConfig(unmarshaler),
    53  		OracleConfigs:       newOracleSpecs(unmarshaler),
    54  		PriceMonitoring:     newPriceMonitoring(unmarshaler),
    55  		MarginCalculators:   newMarginCalculators(unmarshaler),
    56  		LiquidityMonitoring: newLiquidityMonitoring(unmarshaler),
    57  		LiquiditySLAParams:  newLiquiditySLAParams(unmarshaler),
    58  		LiquidationStrat:    newLiquidationConfig(unmarshaler),
    59  	}
    60  }
    61  
    62  func NewSuccessorConfig() *SuccessorConfig {
    63  	u := defaults.NewUnmarshaler()
    64  	zero := num.DecimalZero()
    65  	return &SuccessorConfig{
    66  		InsuranceFraction:   zero,
    67  		PriceMonitoring:     newPriceMonitoring(u),
    68  		LiquidityMonitoring: newLiquidityMonitoring(u),
    69  		RiskModels:          newRiskModels(u),
    70  		PriceRange:          zero,
    71  		LinSlip:             zero,
    72  		QuadSlip:            zero,
    73  		LiquidationStrat:    newLiquidationConfig(u),
    74  	}
    75  }