code.vegaprotocol.io/vega@v0.79.0/core/integration/steps/execution.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 steps
    17  
    18  import (
    19  	"context"
    20  	"time"
    21  
    22  	"code.vegaprotocol.io/vega/core/types"
    23  	"code.vegaprotocol.io/vega/libs/num"
    24  )
    25  
    26  // the interface for execution engine. The execution engine itself will be wrapped
    27  // so to use it in steps, we'll need to use an interface.
    28  type Execution interface {
    29  	GetMarketData(mktID string) (types.MarketData, error)
    30  	GetMarketState(mktID string) (types.MarketState, error)
    31  	AmendOrder(ctx context.Context, amendment *types.OrderAmendment, party string) (*types.OrderConfirmation, error)
    32  	CancelOrder(ctx context.Context, cancel *types.OrderCancellation, party string) ([]*types.OrderCancellationConfirmation, error)
    33  	CancelStopOrder(ctx context.Context, cancel *types.StopOrdersCancellation, party string) error
    34  	SubmitOrder(ctx context.Context, submission *types.OrderSubmission, party string) (*types.OrderConfirmation, error)
    35  	GetFillPriceForMarket(marketID string, volume uint64, side types.Side) (*num.Uint, error)
    36  	SubmitStopOrder(ctx context.Context, submission *types.StopOrdersSubmission, party string) (*types.OrderConfirmation, error)
    37  	SubmitLiquidityProvision(ctx context.Context, submission *types.LiquidityProvisionSubmission, party string, lpID string,
    38  		deterministicID string) error
    39  	AmendLiquidityProvision(ctx context.Context, amendment *types.LiquidityProvisionAmendment, party string) error
    40  	CancelLiquidityProvision(ctx context.Context, cancel *types.LiquidityProvisionCancellation, party string) error
    41  	SubmitSpotMarket(ctx context.Context, marketConfig *types.Market, proposer string, oos time.Time) error
    42  	SubmitMarket(ctx context.Context, marketConfig *types.Market, proposer string, oos time.Time) error
    43  	StartOpeningAuction(ctx context.Context, marketID string) error
    44  	UpdateMarket(ctx context.Context, marketConfig *types.Market) error
    45  	UpdateSpotMarket(ctx context.Context, marketConfig *types.Market) error
    46  	BlockEnd(ctx context.Context)
    47  	GetMarket(parentID string, settled bool) (types.Market, bool)
    48  	SucceedMarket(ctx context.Context, successor, parent string) error
    49  
    50  	// even though the batch processing is done above the execution engine, from the feature test point of view
    51  	// it is part of the execution engine
    52  	StartBatch(party string) error
    53  	AddSubmitOrderToBatch(submission *types.OrderSubmission, party string) error
    54  	AddCancelOrderToBatch(cancellation *types.OrderCancellation, party string) error
    55  	AddAmendOrderToBatch(amend *types.OrderAmendment, party string) error
    56  	ProcessBatch(ctx context.Context, party string) error
    57  	OnEpochEvent(ctx context.Context, epoch types.Epoch)
    58  	UpdateMarketState(ctx context.Context, changes *types.MarketStateUpdateConfiguration) error
    59  	UpdateMarginMode(ctx context.Context, party, marketID string, marginMode types.MarginMode, marginFactor num.Decimal) error
    60  
    61  	// AMM stuff
    62  	SubmitAMM(ctx context.Context, submit *types.SubmitAMM) error
    63  	AmendAMM(ctx context.Context, submit *types.AmendAMM) error
    64  	CancelAMM(ctx context.Context, cancel *types.CancelAMM) error
    65  	GetAMMSubAccountID(alias string) (string, bool)
    66  	SetAMMSubAccountIDAlias(alias, id string)
    67  
    68  	// Long block auction callback
    69  	OnNetworkWideAuctionDurationUpdated(ctx context.Context, v interface{}) error
    70  	BeginBlock(ctx context.Context, prevBlockDuration time.Duration)
    71  
    72  	NewProtocolAutomatedPurchase(ctx context.Context, ID string, automatedPurchaseConfig *types.NewProtocolAutomatedPurchaseChanges) error
    73  }