code.vegaprotocol.io/vega@v0.79.0/core/execution/common/interfaces.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 common
    17  
    18  import (
    19  	"context"
    20  	"time"
    21  
    22  	"code.vegaprotocol.io/vega/core/assets"
    23  	dscommon "code.vegaprotocol.io/vega/core/datasource/common"
    24  	"code.vegaprotocol.io/vega/core/datasource/spec"
    25  	"code.vegaprotocol.io/vega/core/events"
    26  	"code.vegaprotocol.io/vega/core/idgeneration"
    27  	"code.vegaprotocol.io/vega/core/liquidity/v2"
    28  	"code.vegaprotocol.io/vega/core/monitor/price"
    29  	"code.vegaprotocol.io/vega/core/risk"
    30  	"code.vegaprotocol.io/vega/core/types"
    31  	"code.vegaprotocol.io/vega/core/types/statevar"
    32  	"code.vegaprotocol.io/vega/libs/num"
    33  )
    34  
    35  var One = num.UintOne()
    36  
    37  //go:generate go run github.com/golang/mock/mockgen -destination mocks/mocks.go -package mocks code.vegaprotocol.io/vega/core/execution/common TimeService,Assets,StateVarEngine,Collateral,OracleEngine,EpochEngine,AuctionState,LiquidityEngine,EquityLikeShares,MarketLiquidityEngine,Teams,AccountBalanceChecker,Banking,Parties,DelayTransactionsTarget
    38  
    39  //go:generate go run github.com/golang/mock/mockgen -destination mocks_amm/mocks.go -package mocks_amm code.vegaprotocol.io/vega/core/execution/common AMMPool,AMM
    40  
    41  // InitialOrderVersion is set on `Version` field for every new order submission read from the network.
    42  const InitialOrderVersion = 1
    43  
    44  // OracleEngine ...
    45  type OracleEngine interface {
    46  	ListensToSigners(dscommon.Data) bool
    47  	Subscribe(context.Context, spec.Spec, spec.OnMatchedData) (spec.SubscriptionID, spec.Unsubscriber, error)
    48  	Unsubscribe(context.Context, spec.SubscriptionID)
    49  }
    50  
    51  // PriceMonitor interface to handle price monitoring/auction triggers
    52  // @TODO the interface shouldn't be imported here.
    53  type PriceMonitor interface {
    54  	OnTimeUpdate(now time.Time)
    55  	CheckPrice(ctx context.Context, as price.AuctionState, price *num.Uint, persistent bool, recordInHistory bool) bool
    56  	ResetPriceHistory(price *num.Uint)
    57  	GetCurrentBounds() []*types.PriceMonitoringBounds
    58  	GetBounds() []*types.PriceMonitoringBounds
    59  	SetMinDuration(d time.Duration)
    60  	GetValidPriceRange() (num.WrappedDecimal, num.WrappedDecimal)
    61  	// Snapshot
    62  	GetState() *types.PriceMonitor
    63  	Changed() bool
    64  	IsBoundFactorsInitialised() bool
    65  	Initialised() bool
    66  	UpdateSettings(risk.Model, *types.PriceMonitoringSettings, price.AuctionState)
    67  }
    68  
    69  // TimeService ...
    70  type TimeService interface {
    71  	GetTimeNow() time.Time
    72  }
    73  
    74  // Broker (no longer need to mock this, use the broker/mocks wrapper).
    75  type Broker interface {
    76  	Send(event events.Event)
    77  	SendBatch(events []events.Event)
    78  	Stage(event events.Event)
    79  }
    80  
    81  type StateVarEngine interface {
    82  	RegisterStateVariable(asset, market, name string, converter statevar.Converter, startCalculation func(string, statevar.FinaliseCalculation), trigger []statevar.EventType, result func(context.Context, statevar.StateVariableResult) error) error
    83  	UnregisterStateVariable(asset, market string)
    84  	NewEvent(asset, market string, eventType statevar.EventType)
    85  	ReadyForTimeTrigger(asset, mktID string)
    86  }
    87  
    88  type Assets interface {
    89  	Get(assetID string) (*assets.Asset, error)
    90  }
    91  
    92  type IDGenerator interface {
    93  	NextID() string
    94  }
    95  
    96  // AuctionState ...
    97  //
    98  //nolint:interfacebloat
    99  type AuctionState interface {
   100  	price.AuctionState
   101  	// are we in auction, and what auction are we in?
   102  	ExtendAuctionSuspension(delta types.AuctionDuration)
   103  	ExtendAuctionLongBlock(delta types.AuctionDuration)
   104  	ExtendAuctionAutomatedPurchase(delta types.AuctionDuration)
   105  	InAuction() bool
   106  	IsOpeningAuction() bool
   107  	IsPriceAuction() bool
   108  	IsFBA() bool
   109  	IsMonitorAuction() bool
   110  	IsPAPAuction() bool
   111  	ExceededMaxOpening(time.Time) bool
   112  	// is it the start/end of an auction
   113  	AuctionStart() bool
   114  	CanLeave() bool
   115  	// when does the auction start/end
   116  	ExpiresAt() *time.Time
   117  	Start() time.Time
   118  	// signal we've started/ended the auction
   119  	AuctionStarted(ctx context.Context, time time.Time) *events.Auction
   120  	AuctionExtended(ctx context.Context, time time.Time) *events.Auction
   121  	ExtendAuction(delta types.AuctionDuration)
   122  	Left(ctx context.Context, now time.Time) *events.Auction
   123  	// get some data
   124  	Mode() types.MarketTradingMode
   125  	Trigger() types.AuctionTrigger
   126  	ExtensionTrigger() types.AuctionTrigger
   127  	// UpdateMinDuration works out whether or not the current auction period (if applicable) should be extended
   128  	UpdateMinDuration(ctx context.Context, d time.Duration) *events.Auction
   129  	// Snapshot
   130  	GetState() *types.AuctionState
   131  	Changed() bool
   132  	UpdateMaxDuration(ctx context.Context, d time.Duration)
   133  	StartGovernanceSuspensionAuction(t time.Time)
   134  	StartLongBlockAuction(t time.Time, d int64)
   135  	StartAutomatedPurchaseAuction(t time.Time, d int64)
   136  	EndGovernanceSuspensionAuction()
   137  }
   138  
   139  type EpochEngine interface {
   140  	NotifyOnEpoch(f func(context.Context, types.Epoch), r func(context.Context, types.Epoch))
   141  }
   142  
   143  type EligibilityChecker interface {
   144  	IsEligibleForProposerBonus(marketID string, volumeTraded *num.Uint) bool
   145  }
   146  
   147  //nolint:interfacebloat
   148  type Collateral interface {
   149  	Deposit(ctx context.Context, party, asset string, amount *num.Uint) (*types.LedgerMovement, error)
   150  	Withdraw(ctx context.Context, party, asset string, amount *num.Uint) (*types.LedgerMovement, error)
   151  	EnableAsset(ctx context.Context, asset types.Asset) error
   152  	GetPartyGeneralAccount(party, asset string) (*types.Account, error)
   153  	GetPartyBondAccount(market, partyID, asset string) (*types.Account, error)
   154  	GetOrCreatePartyOrderMarginAccount(ctx context.Context, partyID, marketID, asset string) (string, error)
   155  	BondUpdate(ctx context.Context, market string, transfer *types.Transfer) (*types.LedgerMovement, error)
   156  	BondSpotUpdate(ctx context.Context, market string, transfer *types.Transfer) (*types.LedgerMovement, error)
   157  	RemoveBondAccount(partyID, marketID, asset string) error
   158  	MarginUpdateOnOrder(ctx context.Context, marketID string, update events.Risk) (*types.LedgerMovement, events.Margin, error)
   159  	GetPartyMargin(pos events.MarketPosition, asset, marketID string) (events.Margin, error)
   160  	GetPartyMarginAccount(market, party, asset string) (*types.Account, error)
   161  	RollbackMarginUpdateOnOrder(ctx context.Context, marketID string, assetID string, transfer *types.Transfer) (*types.LedgerMovement, error)
   162  	GetOrCreatePartyBondAccount(ctx context.Context, partyID, marketID, asset string) (*types.Account, error)
   163  	CreatePartyMarginAccount(ctx context.Context, partyID, marketID, asset string) (string, error)
   164  	FinalSettlement(ctx context.Context, marketID string, transfers []*types.Transfer, factor *num.Uint, useGeneralAccountForMarginSearch func(string) bool) ([]*types.LedgerMovement, error)
   165  	ClearMarket(ctx context.Context, mktID, asset string, parties []string, keepInsurance bool) ([]*types.LedgerMovement, error)
   166  	HasGeneralAccount(party, asset string) bool
   167  	ClearPartyMarginAccount(ctx context.Context, party, market, asset string) (*types.LedgerMovement, error)
   168  	ClearPartyOrderMarginAccount(ctx context.Context, party, market, asset string) (*types.LedgerMovement, error)
   169  	CanCoverBond(market, party, asset string, amount *num.Uint) bool
   170  	Hash() []byte
   171  	TransferFeesContinuousTrading(ctx context.Context, marketID string, assetID string, ft events.FeesTransfer) ([]*types.LedgerMovement, error)
   172  	TransferFees(ctx context.Context, marketID string, assetID string, ft events.FeesTransfer) ([]*types.LedgerMovement, error)
   173  	TransferSpotFees(ctx context.Context, marketID string, assetID string, ft events.FeesTransfer, sourceAccountType types.AccountType) ([]*types.LedgerMovement, error)
   174  	TransferSpotFeesContinuousTrading(ctx context.Context, marketID string, assetID string, ft events.FeesTransfer) ([]*types.LedgerMovement, error)
   175  	MarginUpdate(ctx context.Context, marketID string, updates []events.Risk) ([]*types.LedgerMovement, []events.Margin, []events.Margin, error)
   176  	IsolatedMarginUpdate(updates []events.Risk) []events.Margin
   177  	PerpsFundingSettlement(ctx context.Context, marketID string, transfers []events.Transfer, asset string, round *num.Uint, useGeneralAccountForMarginSearch func(string) bool) ([]events.Margin, []*types.LedgerMovement, error)
   178  	MarkToMarket(ctx context.Context, marketID string, transfers []events.Transfer, asset string, useGeneralAccountForMarginSearch func(string) bool) ([]events.Margin, []*types.LedgerMovement, error)
   179  	RemoveDistressed(ctx context.Context, parties []events.MarketPosition, marketID, asset string, useGeneralAccount func(string) bool) (*types.LedgerMovement, error)
   180  	GetMarketLiquidityFeeAccount(market, asset string) (*types.Account, error)
   181  	GetAssetQuantum(asset string) (num.Decimal, error)
   182  	GetInsurancePoolBalance(marketID, asset string) (*num.Uint, bool)
   183  	AssetExists(string) bool
   184  	CreateMarketAccounts(context.Context, string, string) (string, string, error)
   185  	CreateSpotMarketAccounts(ctx context.Context, marketID, quoteAsset string) error
   186  	SuccessorInsuranceFraction(ctx context.Context, successor, parent, asset string, fraction num.Decimal) *types.LedgerMovement
   187  	ClearInsurancepool(ctx context.Context, marketID string, asset string, clearFees bool) ([]*types.LedgerMovement, error)
   188  	TransferToHoldingAccount(ctx context.Context, transfer *types.Transfer, accountType types.AccountType) (*types.LedgerMovement, error)
   189  	ReleaseFromHoldingAccount(ctx context.Context, transfer *types.Transfer, toAccounType types.AccountType) (*types.LedgerMovement, error)
   190  	ClearSpotMarket(ctx context.Context, mktID, quoteAsset string, parties []string) ([]*types.LedgerMovement, error)
   191  	PartyHasSufficientBalance(asset, partyID string, amount *num.Uint, fromAccountType types.AccountType) error
   192  	PartyCanCoverFees(asset, mktID, partyID string, amount *num.Uint) error
   193  	TransferSpot(ctx context.Context, partyID, toPartyID, asset string, quantity *num.Uint, fromAccountType, toAccountType types.AccountType) (*types.LedgerMovement, error)
   194  	GetOrCreatePartyLiquidityFeeAccount(ctx context.Context, partyID, marketID, asset string) (*types.Account, error)
   195  	GetPartyLiquidityFeeAccount(market, partyID, asset string) (*types.Account, error)
   196  	GetLiquidityFeesBonusDistributionAccount(marketID, asset string) (*types.Account, error)
   197  	CreatePartyGeneralAccount(ctx context.Context, partyID, asset string) (string, error)
   198  	GetOrCreateLiquidityFeesBonusDistributionAccount(ctx context.Context, marketID, asset string) (*types.Account, error)
   199  	CheckOrderSpam(party, market string, assets []string) error
   200  	CheckOrderSpamAllMarkets(party string) error
   201  	GetAllParties() []string
   202  	GetSystemAccountBalance(asset, market string, accountType types.AccountType) (*num.Uint, error)
   203  	EarmarkForAutomatedPurchase(asset string, accountType types.AccountType, min, max *num.Uint) (*num.Uint, error)
   204  	UnearmarkForAutomatedPurchase(asset string, accountType types.AccountType, releaseRequest *num.Uint) error
   205  
   206  	// amm stuff
   207  	SubAccountClosed(ctx context.Context, party, subAccount, asset, market string) ([]*types.LedgerMovement, error)
   208  	SubAccountUpdate(
   209  		ctx context.Context,
   210  		party, subAccount, asset, market string,
   211  		transferType types.TransferType,
   212  		amount *num.Uint,
   213  	) (*types.LedgerMovement, error)
   214  	SubAccountRelease(
   215  		ctx context.Context,
   216  		party, subAccount, asset, market string, pos events.MarketPosition,
   217  	) ([]*types.LedgerMovement, events.Margin, error)
   218  	CreatePartyAMMsSubAccounts(
   219  		ctx context.Context,
   220  		party, subAccount, asset, market string,
   221  	) (general *types.Account, margin *types.Account, err error)
   222  }
   223  
   224  type OrderReferenceCheck types.Order
   225  
   226  const (
   227  	// PriceMoveMid used to indicate that the mid price has moved.
   228  	PriceMoveMid = 1
   229  
   230  	// PriceMoveBestBid used to indicate that the best bid price has moved.
   231  	PriceMoveBestBid = 2
   232  
   233  	// PriceMoveBestAsk used to indicate that the best ask price has moved.
   234  	PriceMoveBestAsk = 4
   235  
   236  	// PriceMoveAll used to indicate everything has moved.
   237  	PriceMoveAll = PriceMoveMid + PriceMoveBestBid + PriceMoveBestAsk
   238  )
   239  
   240  func (o OrderReferenceCheck) HasMoved(changes uint8) bool {
   241  	return (o.PeggedOrder.Reference == types.PeggedReferenceMid &&
   242  		changes&PriceMoveMid > 0) ||
   243  		(o.PeggedOrder.Reference == types.PeggedReferenceBestBid &&
   244  			changes&PriceMoveBestBid > 0) ||
   245  		(o.PeggedOrder.Reference == types.PeggedReferenceBestAsk &&
   246  			changes&PriceMoveBestAsk > 0)
   247  }
   248  
   249  type Banking interface {
   250  	RegisterTradingFees(ctx context.Context, asset string, feesPerParty map[string]*num.Uint)
   251  }
   252  
   253  type Parties interface {
   254  	AssignDeriveKey(ctx context.Context, party types.PartyID, derivedKey string)
   255  }
   256  
   257  type LiquidityEngine interface {
   258  	GetLegacyOrders() []string
   259  	OnEpochRestore(ep types.Epoch)
   260  	ResetSLAEpoch(t time.Time, markPrice *num.Uint, midPrice *num.Uint, positionFactor num.Decimal)
   261  	ApplyPendingProvisions(ctx context.Context, now time.Time) liquidity.Provisions
   262  	PendingProvision() liquidity.Provisions
   263  	PendingProvisionByPartyID(party string) *types.LiquidityProvision
   264  	CalculateSLAPenalties(time.Time) liquidity.SlaPenalties
   265  	ResetAverageLiquidityScores()
   266  	UpdateAverageLiquidityScores(num.Decimal, num.Decimal, *num.Uint, *num.Uint)
   267  	GetAverageLiquidityScores() map[string]num.Decimal
   268  	SubmitLiquidityProvision(context.Context, *types.LiquidityProvisionSubmission, string, liquidity.IDGen) (bool, error)
   269  	RejectLiquidityProvision(context.Context, string) error
   270  	AmendLiquidityProvision(ctx context.Context, lpa *types.LiquidityProvisionAmendment, party string, isCancel bool) (bool, error)
   271  	CancelLiquidityProvision(context.Context, string) error
   272  	ValidateLiquidityProvisionAmendment(*types.LiquidityProvisionAmendment) error
   273  	StopLiquidityProvision(context.Context, string) error
   274  	IsLiquidityProvider(string) bool
   275  	ProvisionsPerParty() liquidity.ProvisionsPerParty
   276  	LiquidityProvisionByPartyID(string) *types.LiquidityProvision
   277  	CalculateSuppliedStake() *num.Uint
   278  	CalculateSuppliedStakeWithoutPending() *num.Uint
   279  	UpdatePartyCommitment(string, *num.Uint) (*types.LiquidityProvision, error)
   280  	EndBlock(*num.Uint, *num.Uint, num.Decimal)
   281  	UpdateMarketConfig(liquidity.RiskModel, liquidity.PriceMonitor)
   282  	UpdateSLAParameters(*types.LiquiditySLAParams)
   283  	OnNonPerformanceBondPenaltySlopeUpdate(num.Decimal)
   284  	OnNonPerformanceBondPenaltyMaxUpdate(num.Decimal)
   285  	OnMinProbabilityOfTradingLPOrdersUpdate(num.Decimal)
   286  	OnProbabilityOfTradingTauScalingUpdate(num.Decimal)
   287  	OnMaximumLiquidityFeeFactorLevelUpdate(num.Decimal)
   288  	OnStakeToCcyVolumeUpdate(stakeToCcyVolume num.Decimal)
   289  	OnProvidersFeeCalculationTimeStep(time.Duration)
   290  	IsProbabilityOfTradingInitialised() bool
   291  	GetPartyLiquidityScore(orders []*types.Order, bestBid, bestAsk num.Decimal, minP, maxP *num.Uint) num.Decimal
   292  
   293  	LiquidityProviderSLAStats(t time.Time) []*types.LiquidityProviderSLA
   294  
   295  	RegisterAllocatedFeesPerParty(feesPerParty map[string]*num.Uint)
   296  	PaidLiquidityFeesStats() *types.PaidLiquidityFeesStats
   297  
   298  	ReadyForFeesAllocation(time.Time) bool
   299  	ResetFeeAllocationPeriod(t time.Time)
   300  
   301  	V1StateProvider() types.StateProvider
   302  	V2StateProvider() types.StateProvider
   303  	StopSnapshots()
   304  }
   305  
   306  type MarketLiquidityEngine interface {
   307  	OnEpochStart(context.Context, time.Time, *num.Uint, *num.Uint, *num.Uint, num.Decimal)
   308  	OnEpochEnd(context.Context, time.Time, types.Epoch)
   309  	OnTick(context.Context, time.Time)
   310  	EndBlock(*num.Uint, *num.Uint, num.Decimal)
   311  	SubmitLiquidityProvision(context.Context, *types.LiquidityProvisionSubmission, string, string, types.MarketState) error
   312  	AmendLiquidityProvision(context.Context, *types.LiquidityProvisionAmendment, string, string, types.MarketState) error
   313  	CancelLiquidityProvision(context.Context, string) error
   314  	UpdateMarketConfig(liquidity.RiskModel, liquidity.PriceMonitor)
   315  	UpdateSLAParameters(*types.LiquiditySLAParams)
   316  	OnEarlyExitPenalty(num.Decimal)
   317  	OnMinLPStakeQuantumMultiple(num.Decimal)
   318  	OnBondPenaltyFactorUpdate(num.Decimal)
   319  	OnNonPerformanceBondPenaltySlopeUpdate(num.Decimal)
   320  	OnNonPerformanceBondPenaltyMaxUpdate(num.Decimal)
   321  	OnMinProbabilityOfTradingLPOrdersUpdate(num.Decimal)
   322  	OnProbabilityOfTradingTauScalingUpdate(num.Decimal)
   323  	OnMaximumLiquidityFeeFactorLevelUpdate(num.Decimal)
   324  	OnStakeToCcyVolumeUpdate(stakeToCcyVolume num.Decimal)
   325  	OnProvidersFeeCalculationTimeStep(d time.Duration)
   326  	StopAllLiquidityProvision(context.Context)
   327  	IsProbabilityOfTradingInitialised() bool
   328  	GetAverageLiquidityScores() map[string]num.Decimal
   329  	ProvisionsPerParty() liquidity.ProvisionsPerParty
   330  	OnMarketClosed(context.Context, time.Time)
   331  	CalculateSuppliedStake() *num.Uint
   332  	SetELSFeeFraction(d num.Decimal)
   333  }
   334  
   335  type EquityLikeShares interface {
   336  	AllShares() map[string]num.Decimal
   337  	SetPartyStake(id string, newStakeU *num.Uint)
   338  	HasShares(id string) bool
   339  }
   340  
   341  type AMMPool interface {
   342  	OrderbookShape(from, to *num.Uint, idgen *idgeneration.IDGenerator) *types.OrderbookShapeResult
   343  	LiquidityFee() num.Decimal
   344  	CommitmentAmount() *num.Uint
   345  }
   346  
   347  type AMM interface {
   348  	GetAMMPoolsBySubAccount() map[string]AMMPool
   349  	GetAllSubAccounts() []string
   350  	IsAMMPartyID(string) bool
   351  }
   352  
   353  type CommonMarket interface {
   354  	GetID() string
   355  	Hash() []byte
   356  	GetAssets() []string
   357  	Reject(context.Context) error
   358  	GetMarketData() types.MarketData
   359  	StartOpeningAuction(context.Context) error
   360  	GetEquityShares() *EquityShares
   361  	GetEquitySharesForParty(partyID string) num.Decimal
   362  	IntoType() types.Market
   363  	OnEpochEvent(ctx context.Context, epoch types.Epoch)
   364  	OnEpochRestore(ctx context.Context, epoch types.Epoch)
   365  	GetAssetForProposerBonus() string
   366  	GetMarketCounters() *types.MarketCounters
   367  	GetPartiesStats() *types.MarketStats
   368  	GetMarketState() types.MarketState
   369  	BlockEnd(context.Context)
   370  	BeginBlock(context.Context)
   371  	UpdateMarketState(ctx context.Context, changes *types.MarketStateUpdateConfiguration) error
   372  	GetFillPrice(volume uint64, side types.Side) (*num.Uint, error)
   373  	Mkt() *types.Market
   374  	EnterLongBlockAuction(ctx context.Context, duration int64)
   375  
   376  	IsOpeningAuction() bool
   377  
   378  	// network param updates
   379  	OnMarketPartiesMaximumStopOrdersUpdate(context.Context, *num.Uint)
   380  	OnMarketMinLpStakeQuantumMultipleUpdate(context.Context, num.Decimal)
   381  	OnMarketMinProbabilityOfTradingLPOrdersUpdate(context.Context, num.Decimal)
   382  	OnMarketProbabilityOfTradingTauScalingUpdate(context.Context, num.Decimal)
   383  	OnMarketValueWindowLengthUpdate(time.Duration)
   384  	OnFeeFactorsInfrastructureFeeUpdate(context.Context, num.Decimal)
   385  	OnFeeFactorsTreasuryFeeUpdate(context.Context, num.Decimal)
   386  	OnFeeFactorsBuyBackFeeUpdate(context.Context, num.Decimal)
   387  	OnFeeFactorsMakerFeeUpdate(context.Context, num.Decimal)
   388  	OnMarkPriceUpdateMaximumFrequency(context.Context, time.Duration)
   389  	OnMarketAuctionMinimumDurationUpdate(context.Context, time.Duration)
   390  	OnMarketAuctionMaximumDurationUpdate(context.Context, time.Duration)
   391  	OnMarketLiquidityV2EarlyExitPenaltyUpdate(num.Decimal)
   392  	OnMarketLiquidityV2MaximumLiquidityFeeFactorLevelUpdate(num.Decimal)
   393  	OnMarketLiquidityV2SLANonPerformanceBondPenaltySlopeUpdate(num.Decimal)
   394  	OnMarketLiquidityV2SLANonPerformanceBondPenaltyMaxUpdate(num.Decimal)
   395  	OnMarketLiquidityV2StakeToCCYVolume(d num.Decimal)
   396  	OnMarketLiquidityV2BondPenaltyFactorUpdate(d num.Decimal)
   397  	OnMarketLiquidityV2ProvidersFeeCalculationTimeStep(t time.Duration)
   398  	OnMarketLiquidityEquityLikeShareFeeFractionUpdate(d num.Decimal)
   399  	OnAMMMinCommitmentQuantumUpdate(context.Context, *num.Uint)
   400  	OnMarketAMMMaxCalculationLevels(context.Context, *num.Uint)
   401  
   402  	// liquidity provision
   403  	CancelLiquidityProvision(context.Context, *types.LiquidityProvisionCancellation, string) error
   404  	AmendLiquidityProvision(context.Context, *types.LiquidityProvisionAmendment, string, string) error
   405  	SubmitLiquidityProvision(context.Context, *types.LiquidityProvisionSubmission, string, string) error
   406  
   407  	// order management
   408  	SubmitOrderWithIDGeneratorAndOrderID(context.Context, *types.OrderSubmission, string, IDGenerator, string, bool) (*types.OrderConfirmation, error)
   409  	AmendOrderWithIDGenerator(context.Context, *types.OrderAmendment, string, IDGenerator) (*types.OrderConfirmation, error)
   410  	CancelAllOrders(context.Context, string) ([]*types.OrderCancellationConfirmation, error)
   411  	CancelOrderWithIDGenerator(context.Context, string, string, IDGenerator) (*types.OrderCancellationConfirmation, error)
   412  	CancelAllStopOrders(context.Context, string) error
   413  	CancelStopOrder(context.Context, string, string) error
   414  	SubmitStopOrdersWithIDGeneratorAndOrderIDs(context.Context, *types.StopOrdersSubmission, string, IDGenerator, *string, *string) (*types.OrderConfirmation, error)
   415  
   416  	SubmitAMM(context.Context, *types.SubmitAMM, string) error
   417  	AmendAMM(context.Context, *types.AmendAMM, string) error
   418  	CancelAMM(context.Context, *types.CancelAMM, string) error
   419  
   420  	PostRestore(context.Context) error
   421  	ValidateSettlementData(*num.Uint) bool
   422  }
   423  
   424  type AccountBalanceChecker interface {
   425  	GetAvailableBalance(party string) (*num.Uint, error)
   426  	GetAllStakingParties() []string
   427  }
   428  
   429  type Teams interface {
   430  	GetTeamMembers(team string, minEpochsInTeam uint64) []string
   431  	GetAllPartiesInTeams(minEpochsInTeam uint64) []string
   432  	GetAllTeamsWithParties(minEpochsInTeam uint64) map[string][]string
   433  }
   434  
   435  type DelayTransactionsTarget interface {
   436  	MarketDelayRequiredUpdated(marketID string, required bool)
   437  }