AutoDeleveraging

AutoDeleveraging encode

Name
Rule

type

1byte with the value 0x0b

accountId

4 bytes

subAccountId

1 byte

subAccountNonce

4 bytes

oraclePrices

31 bytes, encode the ContractPrice and MarginPrice in order, pass the bytes to Rust SDK rescue_hash method

adlAccountId

4 bytes

pairId

1 byte

adlSize

5 bytes, refer to amount pack method in BigUint pack algorithm

adlPrice

15 bytes, encode to big endian bytes, then pass to thepad_front function in Rust SDK

fee

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

feeToken

2 bytes

ContractPrice encode

Name
Rule

pariId

1 byte

marketPrice

15 bytes, encode in big endian, then pass to the pad_front function in Rsut SDK

MarginPrice encode

Name
Rule

tokenId

2 byte, change to u16, then encode in big endian

marketPrice

15 bytes, encode in big endian, then pass to thepad_front function in Rust SDK

Example

For the auto deleveraging as below:

Last updated

Was this helpful?