Futures Contract

On DMEX, users trade futures contracts. Futures contracts are defined by the following parameters:

Parameter

Type

Description

asset

bytes32

the hash of the underlying asset object

expirationBlock

uint256

futures contract expiration block

closingPrice

uint256

the closing price for the futures contract

closed

bool

is the futures contract closed? (0 - false, 1 - true)

broken

bool

if someone has forced release of funds after no settlement for two hours, the contract is marked as broken and can no longer close positions, all collaterals are released

multiplier

uint256

the multiplier price (usually 1/ETHUSD x 1e8)

fundingRate

uint256

funding rate expressed per block * 1e18

closingBlock

uint256

the block in which the contract was closed (0 while contract open)

perpetual

bool

true if the contract is perpetual

maintenanceMargin

uint256

the maintenance margin coefficient

The Futures Contract has a unique hash derived from its parameters. There can be no two futures contracts with the same hash and different parameters as all parameters are included in the hash. A change in any parameter will result in a new futures contract hash.

bytes32 futuresContractHash = keccak256(
    this, 
    asset, 
    expirationBlock, 
    multiplier, 
    fundingRate, 
    perpetual, 
    maintenanceMargin
);

When a user places an order, the order is placed to trade a specific futures contract and the futures contract hash is embedded in the user’s signature. This way the user can be sure that he/she is trading the correct asset/futures contract.

Last updated