On-Chain Configuration

The StarkEx Perpetual Trading system configuration smart contract contains:

  • global configuration parameters

  • configuration parameters for each synthetic asset

The system configuration must be reflected on-chain in order to preserve soundness. In order to reduce gas costs, a hash committment of the full configuration is stored on-chain, rather than the full configuration smart contract itself.

To understand the importance of storing the system configuratio on-chain, consider the following example:

In a given system, one configuration dictates who is allowed to sign on price feeds of the different assets. If a batch is proven with respect to an invalid Oracle, which is different from what is reflected on-chain, then the proof is rejected. Otherwise, a malicious operator could change this configuration off-chain and sign any price feed with an arbitrary price.

If you are worried about the security of the system, check that you can access the full configuration, along with the hash calculations that attest to it corresponding to the on-chain configuration commitment. You can get this information, for example, on the application site.

Global Configuration

Contains the following fields:

collateral_asset_info

Contains asset_id and resolution for the collateral token.

fee_position_info

Contains position_id and the public Stark key, public_key, of the party that receives fees from users for transactions that take place in the system.

max_funding_rate

Used to verify asset_id for the Funding tick transaction off-chain collateral.

orders_tree_height

The height of the Orders tree.

positions_tree_height

The height of the Balances tree.

timestamp_validation_config
funding_validity_period

Used to check the validity of funding ticks.

price_validity_period

Used to check the validity of oracle price ticks.

Configuration Per Synthetic assetId

Contains the following fields:

<ID>

The synthetic asset’s ID.

oracle_price_quorum

The number of oracle signers required to approve a new price for a given synthetic asset.

oracle_price_signed_asset_ids

A list of possible IDs to identify this asset, for use with different oracle companies. For more information, see Becoming an oracle provider for StarkEx.

oracle_price_signers

A list of public Stark keys that have permission to sign on oracle prices for a given synthetic asset.

resolution

The asset’s resolution.

risk_factor

The asset’s risk factor. The risk factor is a representation of the maintenance margin required for this asset. For more information, see Margin and Total value and total risk.