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
  • type ContractBuilder
  • type Contract
  • type ContractMatchingBuilder
  • type ContractMatching

Was this helpful?

  1. Developer
  2. SDK
  3. Go
  4. Transactions

ContractMatching

PreviousOrderMatchingNextAutoDeleveraging

Last updated 1 year ago

Was this helpful?

type ContractBuilder

type ContractBuilder struct {
    AccountId    AccountId
    SubAccountId SubAccountId
    SlotId       SlotId
    Nonce        Nonce
    PairId       PairId
    Size         BigUint
    Price        BigUint
    Direction    bool
    TakerFeeRate uint8
    MakerFeeRate uint8
    HasSubsidy   bool
}

Builder used to build

type Contract

The struct of taker and maker in perpetual contract, it's a opaque data type.

func NewContract

func NewContract(builder ContractBuilder) *Contract

Create a new Contract.

func (*Contract) IsLong

func (*Contract) IsLong() bool

Return true if the contract opens a long position.

func (*Contract) IsShort

func (*Contract) IsShort() bool

Return true if the contract opens a short position.

func (*Contract) GetSignature

func (_self *Contract) GetSignature() ZkLinkSignature

Get the L3 signature of the contract.

func (*Contract) IsSignatureValid

func (*Contract) IsSignatureValid() bool

Check if the signature is valid or not.

func (*Contract) GetBytes

func (*Contract) GetBytes() []uint8 

Get the encoded bytes that used to create the L3 signature.

func (*Contract) CreateSignedContract

func (*Contract) CreateSignedContract(zklinkSigner *ZkLinkSigner) (*Contract, error)

Create a new contract with L3 signature.

input:

type ContractMatchingBuilder

type ContractMatchingBuilder struct {
    AccountId    AccountId
    SubAccountId SubAccountId
    Taker        *Contract
    Maker        []*Contract
    Fee          BigUint
    FeeToken     TokenId
}

type ContractMatching

NewContractMatching(builder ContractMatchingBuilder)

func NewContractMatching(builder ContractMatchingBuilder) *ContractMatching

Create a new ContractMatching transaction.

func (*ContractMatching) GetBytes

func (_self *ContractMatching) GetBytes() []uint8

func (*ContractMatching) TxHash

func (*ContractMatching) TxHash() []uint8

Get the transaction hash of the transaction.

func (*ContractMatching) JsonStr

func (*ContractMatching) JsonStr() string

Get the json string of the the transaction.

func (*ContractMatching) IsValid

func (*ContractMatching) IsValid() bool

Check if the transaction is valid or not.

func (*ContractMatching) CreateSignedTx

func (*ContractMatching) CreateSignedTx(signer *ZkLinkSigner) (*ContractMatching, error)

Create a new transaction with L3 signature.

input:

func (*ContractMatching) GetSignature

func (*ContractMatching) GetSignature() ZkLinkSignature

Get the L3 signature of the transaction.

func (*ContractMatching) IsSignatureValid

func (*ContractMatching) IsSignatureValid() bool

Check if the inside L3 signature is valid or not.

func (*ContractMatching) ToZklinkTx

func (*ContractMatching) ToZklinkTx() ZkLinkTx

zklinkSigner:

The transaction in perpetual contract, it's a opaque data type.

Get the encoded bytes that used to create the L3 signature. See more in .

signer:

Change the transaction to the

🛠️
ContractMatching
Private Key and Signature
Contract
Contract
ZkLinkTx
zklinkSigner
ZkLinkSigner