2 releases
0.1.1 | Feb 22, 2023 |
---|---|
0.1.0 | Feb 22, 2023 |
#23 in #defi
44KB
1K
SLoC
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
.
Cross Program Invocations
Instructions
The instructions currently supported are as follows:
initialize_margin_account
- create and initialize a user's margin accountinitialize_open_orders
- create and initialize user's open orders accountdeposit
- deposit USDC collateral into the margin accountwithdraw
- withdraw USDC collateral from the margin accountplace_order_v4
- place a futures order of (price, size, side) on the relevant marketplace_perp_order_v2
- place a perp order of (price, size, side) on the relevant marketcancel_order_xxx
- collection of order cancellation functions, by orderId, clientOrderId, market, etcclose_open_orders
- close open orders accountliquidate
- trigger liquidation
Accounts
The accounts and relevant data that is currently supported (non-exhaustive):
ZetaGroup
- contains information relating to all derivatives market for an underlying- Underlying
- Serum Market
- Strike
- Kind (Call, Put, Future)
- Expiry
Greeks
- Mark Price
- Delta
- Vega
- IV
MarginAccount
- Balance
- Positions
- helper functions: get_initial_margin(), get_maintenance_margin(), get_unrealized_pnl()
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.
Dependencies
~19–30MB
~488K SLoC