UpdateGlobalVar
Parameter Encode
feeAccount
Name | Rule |
---|---|
type | 1 byte, |
feeAccount | 4 byte |
5 bytes in total
insuranceFundAccount
Name | Rule |
---|---|
type | 1 byte, |
accountId | 4 bytes |
5 bytes in total
marginInfo
Name | Rule |
---|---|
type | 1 byte, |
marginId | 1 bytes |
tokenId | 2 bytes, downcast to u16, then encode in big endian |
ratio | 1 byte |
contractInfo
Name | Rule |
---|---|
type | 1 byte, |
pariId | 1 bytes, downcast to u8 as 1 byte |
symbol | 15 bytes, expand to 15 bytes with |
initialMarginRate | 2 bytes |
maintenanceMarginRate | 2 bytes |
fundingInfos
Name | Rule |
---|---|
type | 1 byte, |
infos | 18 bytes * the length of fundingRates, encode |
where fundingInfo
encode rule is:
Name | Rule |
---|---|
pariId | 1 bytes, downcast to u8 as 1 byte |
price | 15 bytes, refer to the Rust SDK |
fundingRate | 2 bytes |
18 bytes in total, where fundingRate
encode is as following:
Get the absolute result as
u16
type,then encode as 2 bytes in big endian.If fundingRate < 0:
bytes[0] |= 0b1000_0000
UpdateGlobalVar Encode
Name | Rule |
---|---|
type | 1 byte, |
fromChainId | 1 byte |
subAccountId | 4 bytes |
parameter | refer to the Parameter encode |
serialId | 8 bytes |
Example
With FundingInfo encode:
With FeeAccount encode:
with insuranceFundAccount encode:
With MarginInfo encode:
With ContractInfo encode:
Last updated