State Update

Updates are generated after zkLinkTx execution, details can be found in StateUpdateResp. Parsing the updates can get some data that is only known after the transaction is executed, such as the actual withdraw amount of FullExit

AccountUpdate.

There are 4 types of AccountUpdate:

  1. AccountCreate: A new account created on the state tree;

  2. AccountChangePubkeyUpdate: The pubkey and nonce changed;

  3. BalanceUpdate: The assets of account and nonce changed;

  4. OrderUpdate: The order slot of the account has changed.

Name
Type
Description

type

String

Update Name

updateId

i32

Update id

accountId

The new accout id

address

String

The account address

Transaction that generate AccountCreate:

For Example:

{
  "type": "AccountCreate",
   "updateId": 40,
   "accountId": 42,
   "address": "0xe4efc3d7b69a19d3ae574cbc2915ddf598efe43f"
}

GlobalVarUpdate

GlobalVarsUpdate is an enumeration type used to represent the update status of global variables. It includes the following 4 types:

  1. FeeAccountUpdate: The fee account of global variables changed

  2. InsuranceFundAccountUpdate: The Insurance fund account of global variables changed

  3. MarginParamsUpdate: The margin parameter of global variables changed

  4. ContractParamsUpdate: The contract parameter of global variables changed

Field
Type
Description

type

String

The update name

update_id

i32

update index

sub_account_id

sub-account ID

old_fee_account_id

Old fee account ID

new_fee_account_id

New fee account ID

Transaction that generate FeeAccountUpdate:

For Example:

Deposit

Updates generated by Deposit:

[update]: this update may occur, update(account): the update related to a certain account. The account id of global_asset is 1, and the account id of fee is 0.

When the to account does not exist, a new account will be automatically created by AccountCreate.

Example

FullExit

Updates generated by FullExit:

Example

ChangePubKey

Updates generated by ChangePubKey:

Example

Transfer

Updates generated by Transfer:

Similar to Deposit, when the to account does not exist, a new account will be automatically created by AccountCreate.

Example

Withdraw

Updates generated by Withdraw:

Example

ForcedExit

Updates generated by ForcedExit:

Example

OrderMatching

Updates generated by OrderMatching:

Example

ContractMatching

Updates generated by ContractMatching:

Example

Liquidation

Updates generated by Liquidation:

Example

AutoDeleveraging

Updates generated by AutoDeleveraging:

Example

funding

Updates generated by funding:

Example

update_global_var

All updates that may be generated by update_global_var:

Example

version: fa4618

Last updated

Was this helpful?