Class StrategyEngine

The strategy engine is used to decide if a SFX should be executed or not. The decision is seperated into two parts:

XTX Strategy: Before the strategy engine evaluates individual SFXs, it evaluates the XTX as a whole. To complete a XTX, all SFXs must be executed and confirmed. For this reason the XTX strategy can be used to evaluate a set of constraints for each SFX in the XTX. If any of the SFXs in the XTX fail the XTX strategy, the XTX will be rejected and not further tracked.

For example, this can be useful for ensuring every SFX as a certain amount of insurance. XTXs containing SFXs with low insurance risk being reverted, as the fine for not completing the SFX is potentially too low. Executors can use the parameters provided in the XtXStrategy to enforce XTX-wide constraints.

SFX Strategy: If an XTX passes the XTX strategy, the strategy engine will evaluate each SFX individually. To goal here is to determine if a SFX passes all constraints set by the SFX strategy. If so, the executor will then submit a bid for the SFX. The bid amount is not determined by the strategy engine, but by the bidding engine.

Hierarchy

  • StrategyEngine

Constructors

Properties

sfxStrategies: {
    [target: string]: SfxStrategy;
} = {}

Type declaration

supportedAssets: {
    [target: string]: string[];
} = {}

Type declaration

  • [target: string]: string[]
xtxStrategies: {
    [target: string]: XtxStrategy;
} = {}

Type declaration

Methods

  • Evaluates the output asset is supported by the executor

    Parameters

    Returns void | Error

    Error if asset is not supported

  • Computes different types of shares for a given SFX.

    Parameters

    • sfx: SideEffect

      Object of SFX compute

    • type: string

      Fee, insurance or yield

    Returns number

    Share of the given type

  • Evaluates the XTX strategy for a given XTX. If the XTX fails the evaluation, the XTX will be rejected, preventing any bids to be submitted

    Parameters

    • xtx: Execution

      Object of XTX to be evaluated

    Returns void | Error

  • Returns minProfitUsd constraint from the SFX strategy for a given target.

    Parameters

    Returns number

    MinProfitUsd constraint from the SFX strategy for a given target

  • Checks if the gateway is supported by the executor. If a config for the gateway exists, this is the case.

    Parameters

    Returns void

  • Evaluates the maxAssetCost constraint from the SFX strategy for a given SFX.

    Parameters

    Returns void | Error

    Error if the maxAssetCost constraint is not met

  • Evaluates the maxTxFeeShare constraint from the SFX strategy for a given SFX.

    Parameters

    Returns void | Error

    Error if the maxTxFeeShare constraint is not met

  • Evaluates the maxTxFeesUsd constraint from the SFX strategy for a given SFX.

    Parameters

    Returns void | Error

    Error if the maxTxFeesUsd constraint is not met

  • Evaluates the minInsuranceAmountUsd constraint from the SFX strategy for a given SFX.

    Parameters

    Returns void | Error

    Error if the minInsuranceAmountUsd constraint is not met

  • Evaluates the minInsuranceAmountUsd constraint from the SFX strategy for a given SFX.

    Parameters

    Returns void | Error

    Error if the minInsuranceAmountUsd constraint is not met

  • Evaluates the minProfitUsd constraint from the SFX strategy for a given SFX.

    Parameters

    Returns void | Error

    Error if the minProfitUsd constraint is not met

  • Evaluates the minYield constraint from the SFX strategy for a given SFX.

    Parameters

    Returns void | Error

    Error if the minYield constraint is not met

Generated using TypeDoc