ContractMatching

Contract encode

Name
Rule

type

1 byte, 0xfe

accountId

4 bytes

subAccountId

1 byte

slotId

2 bytes, use the lower 2 bytes of u32

nonce

3 bytes, encode to 4 bytes in big endian, keep the bytes[1..3]

pairId

1 byte, encode to 2 bytes in big endian, keep the lower byte

direction

1 byte

size

5 bytes

price

15 bytes

feeRates

2 bytes

hasSubsidy

1 byte

ContractMatching encode

Name
Rule

type

1 byte, 0x09

accountId

4 bytes

subAccountId

1 byte

maker,taker

31 bytes

fee

2 bytes, refer to fee pack method in BigUint pack algorithm

feeToken

2 bytes

41 bytes in total, where the maker and taker encode as bellow:

  • Encode the items in maker into a bytes list in order;

  • Encode the taker and append to the bytes list;

  • pass the bytes list to the rescue_hash_orders function in SDK, and get the 31 bytes result.

Example

Last updated

Was this helpful?