zkLink X Documentaion
HomeGitHubBlogExplorer
  • 🙂Welcome
    • Introduction
  • ⚖️Architecture
    • Overview
    • Settlement Layer
      • Working Principal of A Multi-Chain ZK-Rollup
      • Nexus: Settlement on ETH L2s
      • Origin: Settlement on ETH and Alt-L1s
      • Multi-Chain State Synchronization
        • In-Detail: Nexus Multi-Chain State Synchronization
      • Supported Networks of zkLink Nexus and Origin
      • Security Assumptions of zkLink Nexus and Origin
    • Execution Layer
      • TS-zkVM for App Rollup
    • Sequencing Layer
    • DA Layer
  • 🛠️Developer
    • Developer Overview
    • Get Started
    • Examples
      • Base Demo
    • JSON RPC & Websocket & Kafka
      • JSON-RPC API
      • JSON-RPC Errors
      • Websocket
      • Kafka
    • Transactions
      • Basic Types
      • State Update
      • Transaction
        • Deposit
        • FullExit
        • ChangePubKey
        • Withdraw
        • Transfer
        • ForcedExit
        • OrderMatching
        • AutoDeleveraging
        • ContractMatching
        • Funding
        • Liquidation
        • UpdateGlobalVar
      • Private Key & Signature
        • Algorithm
        • ChangePubKey
        • Withdraw
        • Transfer
        • ForcedExit
        • OrderMatching
        • ContractMatching
        • Funding
        • Liquidation
        • AutoDeleveraging
        • UpdateGlobalVar
    • SDK
      • Go
        • Types
        • Signature
        • Utils
        • Transactions
          • ChangePubKey
          • Withdraw
          • Transfer
          • ForcedExit
          • OrderMatching
          • ContractMatching
          • AutoDeleveraging
          • Funding
          • Liquidation
          • UpdateGlobalVar
      • Js
        • Signature
        • Utils
        • Transactions
          • ChangePubKey
          • Withdraw
          • Transfer
          • ForcedExit
          • OrderMatching
          • ContractMatching
          • AutoDeleveraging
          • Funding
          • Liquidation
          • UpdateGlobalVar
      • Dart
        • Signature
        • Utils
        • Transactions
          • ChangePubKey
          • Withdraw
          • Transfer
          • ForcedExit
          • OrderMatching
          • ContractMatching
          • AutoDeleveraging
          • Funding
          • Liquidation
          • UpdateGlobalVar
  • ⚙️Network Information
    • Connected Networks
      • Mainnet
      • Testnet
    • DApps & Deployment Addresses
      • Mainnet
      • Testnet
  • Wallet & User Fund Streamline
    • Withdraw
    • Wallet Integration & AA Wallet
    • Deposit
  • Integration Cases
    • Heavyweight Integration (Multi-Chain Derivatives & Spot Exchange)
    • Simple Integration (Multi-Chain Spot Exchange)
  • Appendix
    • Audits
    • FAQ
    • glossary
Powered by GitBook
On this page

Was this helpful?

  1. Developer
  2. Transactions
  3. Transaction

UpdateGlobalVar

This transaction is used to update the global variable settings.

Name
Type
Required
Description

type

String

yes

The value is "UpdateGlovalVar "

fromChainId

yes

The layer3 chain id

subAccountId

yes

The subaccount id

parameter

yes

Different operation has different variable

seriaId

u64

yes

The serial id

There are 5 parameters, different operations correspond to different parameters:

Modify the collect-fee account.

Name
Type
Required
Description

feeAccount

yes

The fee account id

For example:

{
  "type": "UpdateGlobalVar",
  "fromChainId": 1,
  "subAccountId": 1,
  "parameter": {
    "feeAccount": {
      "accountId": 10
    }
  },
  "serialId": 100
}

Modify the insurance fund account

Name
Type
Required
Description

accountId

yes

The account id of insuranceFundAccount

For Example:

{
  "type": "UpdateGlobalVar",
  "fromChainId": 1,
  "subAccountId": 1,
  "parameter": {
    "insuranceFundAccount": {
      "accountId": 9
    }
  },
  "serialId": 100
}

Modify the margin info in the specified index.

Name
Type
Required
Description

marginId

yes

The margin id

tokenId

yes

The Token id

ratio

u8

yes

the ratio, 100 means 1.0%

For example

{
  "type": "UpdateGlobalVar",
  "fromChainId": 1,
  "subAccountId": 1,
  "parameter": {
    "marginInfo": {
      "marginId": 1,
      "tokenId": 9,
      "ratio": 0
    }
  },
  "serialId": 100
}

Modify the info of every perpetual contract pair.

Name
Type
Required
Description

pairId

yes

The pair id

symbol

String

yes

The symbol of the contract

initialMarginRate

u16

yes

The initial margin rate of the contract, 100 means 0.1%

maintenanceMarginRate

u16

yes

The maintenance margin rate, 100 means 0.1%

{
  "type": "UpdateGlobalVar",
  "fromChainId": 1,
  "subAccountId": 1,
  "parameter": {
    "contractInfo": {
      "pairId": 2,
      "symbol": "BTCUSDC",
      "initialMarginRate": 6,
      "maintenanceMarginRate": 8
    }
  },
  "serialId": 100
}

Update the funding rates to accumulated funding rates of the Global Vars for all position(contract pair) in this period

Name
Type
Required
Description

infos

array

yes

funding info list

> pairId

yes

The pair id

> price

yes

the mark price of the trade pair

> fundingRate

i16

yes

the fee funding rate, the actual result needs to be divided by 10^6

For example:

{
  "type": "UpdateGlobalVar",
  "fromChainId": 1,
  "subAccountId": 1,
  "parameter": {
    "fundingInfos": {
      "infos": [
        {
          "pairId": 0,
          "price": "1000000000000000000",
          "fundingRate": 32767
        },
        {
          "pairId": 1,
          "price": "1000000000000000",
          "fundingRate": 0
        }
      ]
    }
  },
  "serialId": 100
}
PreviousLiquidationNextPrivate Key & Signature

Last updated 11 months ago

Was this helpful?

🛠️
Parameter
ChainId
SubAccountId
AccountId
AccountId
MarginId
TokenId
PairId
PairId
BigUint