Skip to content

zetamarkets/zeta-abi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Zeta ABI 🧬

Discord Chat License

Zeta ABI

ABI is Zeta's cross-program integration ecosystem.

This repository contains the Zeta Cross Program Invocation (CPI) interface as well as a usage example abi-wrapper.

# Add to dependencies
zeta-abi = "1.0.0"

Cross Program Invocations

Dependencies

  • anchor 0.26.0
  • solana 0.14.x

Instructions

The instructions currently supported are as follows:

  • initialize_cross_margin_account - create and initialize a user's margin account
  • initialize_cross_margin_account_manager - create and initialize a user's margin account manager
  • initialize_open_orders_v3 - create and initialize user's open orders account
  • deposit_v2 - deposit USDC collateral into the margin account
  • withdraw_v2 - withdraw USDC collateral from the margin account
  • place_perp_order_v3 - place a perp order of (price, size, side) on the relevant market
  • cancel_order_xxx - collection of order cancellation functions, by orderId, clientOrderId, market, etc
  • close_open_orders - close open orders account
  • liquidate_v2 - trigger liquidation

Accounts

The accounts and relevant data that is currently supported (non-exhaustive):

  • State - contains global parameters relating to all markets
    • Fee percentages
    • Admin pubkeys
    • Platform limits
    • Halt state
  • Pricing - global mark prices, pricing params and funding information
    • Mark Prices
    • Funding rates
    • Perp and margin params
  • CrossMarginAccount - individual user margin accounts
    • Balance
    • Positions
    • Orders

Programs

abi-wrapper

Basic usage example outlined in a dummy wrapper program, which simply calls the main zeta program instructions. Also includes account layouts and outlines how to read all relevant on-chain data from the Zeta program. This should give all the boilerplate needed to execute core program functionality both as the smart contract and off-chain client.