Modules

An Anchor generated module, providing a set of structs mirroring the structs deriving Accounts, where each field is a Pubkey. This is useful for specifying accounts for a client.
An Anchor generated module containing the program’s set of instructions, where each method handler in the #[program] mod is associated with a struct defining the input arguments to the method. These should be used directly, when one wants to serialize Anchor instruction data, for example, when speciying instructions on a client.
This crate documents the instructions used in the margin program of the jet-v2 repo.
Module representing the program.

Structs

Configuration for allowed adapters
Data made available to invoked programs by the margin program. Put data here if:
State of an in-progress liquidation
Configuration for allowed liquidators
The configuration account specifying parameters for a token when used in a position within a margin account.

Enums

Description of which program administers a token
Description of the token’s usage
Information about where to find the oracle data for a token

Constants

The threshold at which accounts can have all their debts closed. Accounts with total exposure below this value can have their exposure reduced to zero.
The maximum c-ratio that an account can end a liquidation with.
The maximum amount of equity that can be deducted from an account during liquidation as a fraction of the total dollar value that is expected to need to be liquidated
The maximum duration in seconds of a liquidation before another user may cancel it
The current version for the margin account state
The maximum confidence deviation allowed for an oracle price.
The maximum number of seconds since the last price was by an oracle, before rejecting the price as too stale.
The maximum age to allow for a quoted price for a position (seconds)
The maximum number of positions that a user can register. This may be exceeded by a liquidator.

Statics

The static program ID

Traits

Execute all the mandatory anchor account verifications that are used during deserialization

Functions

Confirms that a given pubkey is equivalent to the program ID
The Anchor codegen exposes a programming model where a user defines a set of methods inside of a #[program] module in a way similar to writing RPC request handlers. The macro then generates a bunch of code wrapping these user defined methods into something that can be executed on Solana.
Returns the program ID
Writes the result of position changes from an adapter invocation.