Why EIP712

To avoid transaction replay attack in different Conflux chains, Conflux DEX follow the way of EIP712 to sign requests from users, which will be validated in MatchFlow and BoomFlow.

General

  • Values in HEX format have 0x prefix.
  • Some values (e.g. amount, price) are BigDecimal or double types, and need to convert to big number in drip format when interact with blockchain. Basically, the formula is: big number = decimal * 10^18.

EIP712 Domain

Primary type: EIP712Domain

Boomflow Domain

NAME TYPE VALUE
name string Boomflow
version string 1.0
chainId uint256 Retrieve from Conflux RPC server
verifyingContract address REST API: /common/boomflow

CRCL Domain

NAME TYPE VALUE
name string CRCL
version string 1.0
chainId uint256 Retrieve from Conflux RPC server
verifyingContract address REST API: /currencies/${name}

In the response of REST API /currencies/${name}, use contractAddress as CRCL contract address, while tokenAddress is the corresponding ERC777 contract address.

chainId is 0 by default, however, client should always retrieve it from Conflux RPC server. E.g. call getStatus to get chain ID in Javascript program.

Place Order

Domain: Boomflow Domain

Primary type: Order

Schema

NAME TYPE VALUE
userAddress address HEX format
amount uint256 big number in drip
price uint256 big number in drip
orderType uint256 limit order: 0, market order: 1
side bool buy order: true, sell order: false
salt uint256 order timestamp
baseAssetAddress address HEX format
quoteAssetAddress address HEX format
feeAddress address HEX format
makerFeePercentage uint256 big number in drip
takerFeePercentage uint256 big number in drip

Cancel Order

Domain: Boomflow Domain

Primary type: CancelRequest

Schema

NAME TYPE VALUE
order order schema placed order
nonce uint256 order cancellation timestamp

Withdraw

Domain: CRCL Domain

Primary type: WithdrawRequest

Schema

NAME TYPE VALUE
userAddress address HEX format
amount uint256 big number in drip
recipient address HEX format
isCrosschain bool
nonce uint256 withdraw timestamp

Transfer

Domain: CRCL Domain

Primary type: TransferRequest

Schema

NAME TYPE VALUE
userAddress address HEX format
amounts uint256[] big number in drip
recipients address[] HEX format
nonce uint256 transfer timestamp