module documentation

Undocumented

Function add_pair_to_auction This instruction adds a currency pair to an existing auction.
Function cancel_order This instruction cancels an open order.
Function change_auction_status This instruction changes the status of an auction
Function claim_vote_reward This instruction is used to claim back the tokens staked during a fill vote by an arbiter.
Function close_auction_epoch_state This instruction is used to close an AuctionEpochState account.
Function close_fill_accounts This instruction is used to close the various accounts opened during the lifecycle of the trade, and additionally give a rebate to the order flow source for its order flow.
Function close_retail_account This instruction closes the retail trader's data account.
Function create_signatory This instruction is used to stake the requisite amount of tokens necessary to endorse flow as retail. This stake is subject to slashing based on the quality of the order flow sent by the signatory server.
Function fill_order This instruction is used to fill an open order
Function fill_vote This instruction is used to vote on the fairness of a fill
Function grant_role This instruction grants the specified role to the principal.
Function grant_role_uninitialized_entry This instruction creates the principal's whitelist entry account and grants the specified role to the principal.
Function init_auction_epoch_state_account This instruction initializes an auction epoch state account
Function init_auction_mapper This instruction initializes the auction mapper account.
Function init_auction_state This instruction initializes an auction for order flow, and describes the specifications of the order flow account.
Function init_bid_record_account This instruction is called by the market maker prior to bidding in an auction.
Function init_global_config_instruction This instruction creates the global config account and sets the DFlow admin.
Function init_market_maker_account This instruction initializes the market maker account
Function init_recovery_vault This instruction creates a recovery vault.
Function init_retail_account This instruction initializes the retail traders account.
Function init_signatory_system This instruction is used to initialize global state for tracking the system of signatory servers.
Function new_order This instruction is called by retail traders when they submit their order. A transaction containing this instruction must be signed by a signatory server.
Function reclaim_auction_bid This instruction is called by the market maker to withdraw its losing auction bids and close its bid record account for the given auction.
Function revoke_role This instruction revokes the specified role from the principal and closes the principal's whitelist account if it no longer grants any permissions.
Function set_new_dflow_admin This instruction updates the DFlow admin.
Function stake_signatory This instruction is used to stake additional tokens into an existing signatory server stake vault.
Function submit_auction_bid This instruction is called by the market maker to bid in an auction.
Function update_encryption_key This instruction updates the market maker's 256-bit X25519 public key.
def add_pair_to_auction(dflow, auction_id, base_currency, quote_currency, auction_owner, base_oracle, quote_oracle):

This instruction adds a currency pair to an existing auction.

Only a certain number of token pairs are allowed to exist in an auction and an error is thrown if this instruction is called when the token pairs count is saturated

Parameters
dflow:ProgramUndocumented
auction_id:intAn unsigned 64 bit integer. The auction ID used as a seed to generate the program derived address
base_currency:PublicKeyThe public key of the base_currency account.
quote_currency:PublicKeyThe public key of the quote_currency account.
auction_owner:PublicKeyThe public key of the auction_owner account.
base_oracle:PublicKeyThe Pyth price oracle associated with the base token in a currency pair.
quote_oracle:PublicKeyThe Pyth price oracle associated with the quote token in a currency pair.
Returns
TransactionInstructionThis function returns an instruction to include in the transaction.
def cancel_order(dflow, retail_account_owner, nonce, vault_meta_account_auction_id, vault_meta_account_auction_epoch, retail_data_account, market_maker_data_account, retail_x_token_account, x_mint):

This instruction cancels an open order.

Cancelling an open order can only be done if it has not been filled and if the order has been filled partially, the retail trader can only cancel the part of the order which is still open.

Parameters
dflow:ProgramUndocumented
retail_account_owner:PublicKeyThe public key of the retail_account_owner account.
nonce:intAn unsigned 64 bit integer. The nonce used as a seed to generate the PDA for the vault token account, taken from the retail trader's account when the order in question was initially created.
vault_meta_account_auction_id:intThe unsigned integer field named auction_id in the vault_meta_account account.
vault_meta_account_auction_epoch:intThe unsigned integer field named auction_epoch in the vault_meta_account account.
retail_data_account:PublicKeyThe retail data account holds state specific to the retail trader. This account is expected to be mutable
market_maker_data_account:PublicKeyThe account storing state specific to the market maker. This account must be owned by the DFlow program, and this account must be initialized by calling the initialize market maker instruction. This account is expected to be mutable
retail_x_token_account:PublicKeyThe SPL token account associated with the retail trader which is used to deposit the sold token into escrow prior to the trade occurring. This account is expected to be mutable
x_mint:PublicKeyThe SPL mint account associated with the token that is sold by the retail trader during the swap.
Returns
TransactionInstructionThis function returns an instruction to include in the transaction.
def change_auction_status(dflow, auction_id, auction_owner, new_status):

This instruction changes the status of an auction

This instruction can be used to change the status of an auction between Halted, Trading, or Expired. Once Expired, the auction will not be revivable.

Parameters
dflow:ProgramUndocumented
auction_id:intAn unsigned 64 bit integer. The auction ID used as a seed to generate the program derived address
auction_owner:PublicKeyThe public key of the auction_owner account.
new_status:intThe new status for the given auction, specified by the auction ID parameter. A value of 0 indicates Trading. A value of 1 indicates Halted. A value of 2 indicates expired. All other values result in a failed transaction.
Returns
TransactionInstructionThis function returns an instruction to include in the transaction.
def claim_vote_reward(dflow, retail_account_owner, nonce, fill_nonce, arbiter, vault_meta_account_auction_id, vault_meta_account_auction_epoch, arbiter_bid_token_account, arbiter_token_account):

This instruction is used to claim back the tokens staked during a fill vote by an arbiter.

If voting with the majority, the arbiter will receieve a payment from the network along with their original vote. However, if the arbiter did not vote in the majority on the fill, they will not receive their tokens back.

Parameters
dflow:ProgramUndocumented
retail_account_owner:PublicKeyThe public key of the retail_account_owner account.
nonce:intAn unsigned 64 bit integer. The nonce used as a seed to generate the PDA for the vault meta account, taken from the retail trader's account when the order in question was initially created.
fill_nonce:intAn unsigned 16 bit integer. The fill nonce taken from the vault meta account at fill time, and used to generate the PDA for the fill record account.
arbiter:PublicKeyThe public key of the arbiter account.
vault_meta_account_auction_id:intThe unsigned integer field named auction_id in the vault_meta_account account.
vault_meta_account_auction_epoch:intThe unsigned integer field named auction_epoch in the vault_meta_account account.
arbiter_bid_token_account:PublicKeyThe SPL token account associated with the arbiter used to receive a payment from the network, with the same mint as the token accounts used by market makers to bid in the associated auction. This account is expected to be mutable
arbiter_token_account:PublicKeyThe SPL token account associated with the arbiter used to vote on the fairness of the fill by the market maker. This account is expected to be mutable
Returns
TransactionInstructionThis function returns an instruction to include in the transaction.
def close_auction_epoch_state(dflow, auction_id, auction_epoch, owner):

This instruction is used to close an AuctionEpochState account.

The auction owner can use this instruction to close the AuctionEpochState account for an old epoch that has no open orders or fills pending settlement. The auction owner can also use this instruction close the AuctionEpochState account for the last, current, or next epoch if the auction is in the Draining state.

Parameters
dflow:ProgramUndocumented
auction_id:intAn unsigned 64 bit integer. The auction ID used as a seed to generate the program derived address
auction_epoch:intAn unsigned 64 bit integer. The integer epoch used to generate the PDA of the auction epoch account
owner:PublicKeyThe account that created the AuctionEpochState account by calling init_auction_epoch_state_account. This account is a signer for the instruction. This account is expected to be mutable
Returns
TransactionInstructionThis function returns an instruction to include in the transaction.
def close_fill_accounts(dflow, retail_account_owner, nonce, fill_nonce, vault_meta_account_auction_id, vault_meta_account_auction_epoch, arbiter, auction_state_account_bid_mint, vault_token_account_mint, market_maker_x_token_account, retail_data_account, market_maker_account_owner, rebate_receiver_token_account, is_rebate_receiver_token_account_uninitialized, is_x_token_account_uninitialized):

This instruction is used to close the various accounts opened during the lifecycle of the trade, and additionally give a rebate to the order flow source for its order flow.

Lamports used to open the accounts will be returned to the payers who opened the accounts.

Parameters
dflow:ProgramUndocumented
retail_account_owner:PublicKeyThe public key of the retail_account_owner account.
nonce:intAn unsigned 64 bit integer. The nonce used as a seed to generate the PDA for the vault token account, taken from the retail trader's account when the order in question was initially created.
fill_nonce:intAn unsigned 16 bit integer. The fill nonce taken from the vault meta account at fill time, and used to generate the PDA for the fill record account.
vault_meta_account_auction_id:intThe unsigned integer field named auction_id in the vault_meta_account account.
vault_meta_account_auction_epoch:intThe unsigned integer field named auction_epoch in the vault_meta_account account.
arbiter:PublicKeyThe public key of the arbiter account.
auction_state_account_bid_mint:PublicKeyThe public key field named bid_mint in the auction_state_account account.
vault_token_account_mint:PublicKeyThe public key field named mint in the vault_token_account account.
market_maker_x_token_account:PublicKeyThe SPL token account associated with the market maker, and which receives the asset sold by the retail trader during a trade. This account is expected to be mutable. This account is the market_maker_account_owner's associated token account for the mint of the asset sent by the retail trader
retail_data_account:PublicKeyThe retail data account holds state specific to the retail trader. This account is expected to be mutable. The key of retail_account_owner must match the field named retail_account_owner in this account
market_maker_account_owner:PublicKeyThe public key of the market maker. This account is expected to be mutable
rebate_receiver_token_account:PublicKeyThe SPL token account associated with the order used to receive a payment from the network, with the same mint as the token accounts used by market makers to bid in the associated auction. This account is expected to be mutable
is_rebate_receiver_token_account_uninitialized:boolTrue if and only if the rebate receiver token account is uninitialized
is_x_token_account_uninitialized:boolTrue if and only if the market maker's X token account is uninitialized
Returns
TransactionInstructionThis function returns an instruction to include in the transaction.
def close_retail_account(dflow, retail_data_account, retail_account_owner):

This instruction closes the retail trader's data account.

When retail traders wish to close their account, and regain the lamports used to allocate the space for their data account, they can call this instruction. Retail traders may not close their account if they have open orders, and must wait for the orders to be filled, or cancel them.

Parameters
dflow:ProgramUndocumented
retail_data_account:PublicKeyThe retail data account holds state specific to the retail trader. This account is being closed, and the destination of the lamports will be the retail_account_owner account. This account is expected to be mutable
retail_account_owner:PublicKeyThe public key of the retail trader. This account is a signer for the instruction. This account is expected to be mutable
Returns
TransactionInstructionThis function returns an instruction to include in the transaction.
def create_signatory(dflow, signatory_server, signatory_server_token_account):

This instruction is used to stake the requisite amount of tokens necessary to endorse flow as retail. This stake is subject to slashing based on the quality of the order flow sent by the signatory server.

Signatory server operators provide helpful network participation by endorsing and forwarding retail order flow to the network. This helpful network participation is rewarded, or slashed based on the quality of order flow sent.

Parameters
dflow:ProgramUndocumented
signatory_server:PublicKeyThe public key of the signatory_server account.
signatory_server_token_account:PublicKeyThe signatory server's token account used for originating the stake transfer. This account is expected to be mutable
Returns
TransactionInstructionThis function returns an instruction to include in the transaction.
def fill_order(dflow, retail_account_owner, nonce, vault_meta_account_fill_nonce, vault_meta_account_auction_id, vault_meta_account_auction_epoch, market_maker_account_owner, y_mint, order_details, fill_amount, fill_price, retail_data_account, market_maker_data_account, x_mint, market_maker_y_token_account, retail_y_token_account, is_y_token_account_uninitialized):

This instruction is used to fill an open order

When a market maker fills an order that is assigned to them, this instruction will partially settle the trade; the retail trader will receive the tokens from the market maker, but the market maker must wait until arbiters have voted on the fairness of the fill in order to receive the retail trader's tokens.

Parameters
dflow:ProgramUndocumented
retail_account_owner:PublicKeyThe public key of the retail_account_owner account.
nonce:intAn unsigned 64 bit integer. The nonce used as a seed to generate the PDA for the vault meta account, taken from the retail trader's account when the order in question was initially created.
vault_meta_account_fill_nonce:intThe unsigned integer field named fill_nonce in the vault_meta_account account. The fill nonce taken from the vault meta account at fill time, and used to generate the PDA for the fill record account.
vault_meta_account_auction_id:intThe unsigned integer field named auction_id in the vault_meta_account account.
vault_meta_account_auction_epoch:intThe unsigned integer field named auction_epoch in the vault_meta_account account.
market_maker_account_owner:PublicKeyThe public key of the market_maker_account_owner account.
y_mint:PublicKeyThe public key of the y_mint account.
order_details:strThe unencrypted order details sent by the retail trader.
fill_amount:intThe fill amount, referring to the amount of tokens to be received by the retail trader in the trade.
fill_price:intThe price, quoted in the quote currency for the given pair, at which the fill is being completed.
retail_data_account:PublicKeyThe retail data account holds state specific to the retail trader. This account is expected to be mutable
market_maker_data_account:PublicKeyThe account storing state specific to the market maker. This account must be owned by the DFlow program, and this account must be initialized by calling the initialize market maker instruction. This account is expected to be mutable
x_mint:PublicKeyThe SPL mint account associated with the token that is sold by the retail trader during the swap.
market_maker_y_token_account:PublicKeyThe SPL token account associated with the market maker, and which sends the asset being received by the retail trader during a trade. This account is expected to be mutable
retail_y_token_account:PublicKeyThe SPL token account associated with the retail trader, and which receives the asset being sent by the market maker during a trade. This account is expected to be mutable. This account is the retail_y_token_account's associated token account for the mint of the asset sent by the market maker
is_y_token_account_uninitialized:boolTrue if and only if the retail trader's Y token account is uninitialized
Returns
TransactionInstructionThis function returns an instruction to include in the transaction.
def fill_vote(dflow, retail_account_owner, nonce, fill_nonce, arbiter, vault_meta_account_auction_id, vote, arbiter_token_account):

This instruction is used to vote on the fairness of a fill

Arbiters vote on the fairness of a fill when the fill is open for voting. In order to vote on a fill, the arbiter must stake tokens on the accuracy of their vote. If the arbiter voted in the majority, they receive their tokens back. Otherwise the tokens are deposited into a DAO governed backstop fund for the protocol.

Parameters
dflow:ProgramUndocumented
retail_account_owner:PublicKeyThe public key of the retail_account_owner account.
nonce:intAn unsigned 64 bit integer. The nonce used as a seed to generate the PDA for the vault meta account, taken from the retail trader's account when the order in question was initially created.
fill_nonce:intAn unsigned 16 bit integer. The fill nonce taken from the vault meta account at fill time, and used to generate the PDA for the fill record account.
arbiter:PublicKeyThe public key of the arbiter account.
vault_meta_account_auction_id:intThe unsigned integer field named auction_id in the vault_meta_account account.
vote:intThe vote value made by the retail trader. Must be populated with 0 for an unfair vote, and 1 for a fair vote.
arbiter_token_account:PublicKeyThe SPL token account associated with the arbiter used to vote on the fairness of the fill by the market maker. This account is expected to be mutable
Returns
TransactionInstructionThis function returns an instruction to include in the transaction.
def grant_role(dflow, principal, role, dflow_admin):

This instruction grants the specified role to the principal.

Parameters
dflow:ProgramUndocumented
principal:PublicKeyThe public key of the principal account.
role:intThe role to grant to the principal.
dflow_admin:PublicKeyThe public key of the DFlow admin. This account is a signer for the instruction. This account is expected to be mutable
Returns
TransactionInstructionThis function returns an instruction to include in the transaction.
def grant_role_uninitialized_entry(dflow, principal, role, dflow_admin):

This instruction creates the principal's whitelist entry account and grants the specified role to the principal.

Parameters
dflow:ProgramUndocumented
principal:PublicKeyThe public key of the principal account.
role:intThe role to grant to the principal.
dflow_admin:PublicKeyThe public key of the DFlow admin. This account is a signer for the instruction. This account is expected to be mutable
Returns
TransactionInstructionThis function returns an instruction to include in the transaction.
def init_auction_epoch_state_account(dflow, auction_id, auction_epoch, owner):

This instruction initializes an auction epoch state account

AuctionEpochState carries state specific to a certain auction that needs to be remembered after the epoch ends. The AuctionEpochState accounts associated with auction epochs N and N + 1 need to be initialized when the auction for epoch N begins (i.e. in the first SubmitAuctionBid that auction N will receive). Recall that if the AuctionState has an epoch field that has value X, then auction X is currently active, and auction X - 1 is currently receiving order flow.

Parameters
dflow:ProgramUndocumented
auction_id:intAn unsigned 64 bit integer. The auction ID used as a seed to generate the program derived address
auction_epoch:intAn unsigned 64 bit integer. The integer epoch used to generate the PDA of the auction epoch account
owner:PublicKeyThe creator and owner of AuctionEpochState account. This account is a signer for the instruction. This account is expected to be mutable
Returns
TransactionInstructionThis function returns an instruction to include in the transaction.
def init_auction_mapper(dflow, dflow_admin):

This instruction initializes the auction mapper account.

The auction mapper account contains a list of auctions that are not deprecated. Auctions will either be in a trading or halted state. This function can only be called by the DFlow admin.

Parameters
dflow:ProgramUndocumented
dflow_admin:PublicKeyThe public key of the DFlow admin. This account is a signer for the instruction. This account is expected to be mutable
Returns
TransactionInstructionThis function returns an instruction to include in the transaction.
def init_auction_state(dflow, auction_id, auction_owner, bid_mint_account, vote_mint_account, min_notional_order_size, max_notional_order_size, notional_decimals, batch_notional_size, vote_size, supported_pairs_count, vote_period, claim_period):

This instruction initializes an auction for order flow, and describes the specifications of the order flow account.

This instruction is only callable by an auction owner. Once the auction is initialized, it remains in a Halted state until the auction owner sets the auction state to Trading.

Parameters
dflow:ProgramUndocumented
auction_id:intAn unsigned 64 bit integer. The auction ID used as a seed to generate the program derived address
auction_owner:PublicKeyThe public key of the auction_owner account.
bid_mint_account:PublicKeyThe public key of the bid_mint_account account.
vote_mint_account:PublicKeyThe public key of the vote_mint_account account.
min_notional_order_size:intThe minimum notional size accepted by this newly initialized auction. The notional size of all order flow purchased in this auction must be greater than or equal to this value
max_notional_order_size:intThe maximum notional size accepted by this newly initialized auction. The notional size of all order flow purchased in this auction must be less than or equal to this value
notional_decimals:intThe number of decimals in `min_notional_order_size`, `max_notional_order_size`, and `batch_notional_size`
batch_notional_size:intThe total notional size of the orders that will be routed to the market maker when the market maker wins this auction. A winning market maker will receive order flow with a total notional size in the range [batch_notional_size, batch_notional_size + max_notional_order_size)
vote_size:intThe amount of tokens in the currency of the vote mint that the arbiter will need to stake every time the arbiter votes on a fill.
supported_pairs_count:intThe number of token pairs for which order flow is sold in this auction.
vote_period:intThe length in seconds of the voting period for orders routed through this auction.
claim_period:intThe length in seconds of the reward claiming period for orders routed through this auction.
Returns
TransactionInstructionThis function returns an instruction to include in the transaction.
def init_bid_record_account(dflow, auction_id, auction_epoch, market_maker_data_account, market_maker_account_owner):

This instruction is called by the market maker prior to bidding in an auction.

Before a market maker bids in an auction, they must use this instruction to initialize an account to track their current bid in the auction.

Parameters
dflow:ProgramUndocumented
auction_id:intAn unsigned 64 bit integer. The auction ID used as a seed to generate the program derived address
auction_epoch:intAn unsigned 64 bit integer. The integer epoch used to generate the PDA of the auction epoch account
market_maker_data_account:PublicKeyThe public key of the market_maker_data_account account.
market_maker_account_owner:PublicKeyThe public key of the market_maker_account_owner account.
Returns
TransactionInstructionThis function returns an instruction to include in the transaction.
def init_global_config_instruction(dflow, dflow_admin):

This instruction creates the global config account and sets the DFlow admin.

The DFlow admin controls access to the protocol by granting roles to accounts that allow them to perform privileged actions such as auction management. This instruction must be the first instruction called after program deployment and can only be called once.

Parameters
dflow:ProgramUndocumented
dflow_admin:PublicKeyThe public key of the DFlow admin. This account is a signer for the instruction. This account is expected to be mutable
Returns
TransactionInstructionThis function returns an instruction to include in the transaction.
def init_market_maker_account(dflow, market_maker_account_owner, max_orders_supported, encryption_pub_key, market_maker_data_account):

This instruction initializes the market maker account

The market maker account tracks state specific to the market maker's market making activities. This instruction must be called prior to a market maker being active on DFlow.

Parameters
dflow:ProgramUndocumented
market_maker_account_owner:PublicKeyThe public key of the market_maker_account_owner account.
max_orders_supported:intThe maximum number of orders supported in the market maker's queue of orders
encryption_pub_key:List[int]The market maker's 256-bit X25519 public key which will be used by retail traders to encrypt their order details
market_maker_data_account:PublicKeyThe account storing state specific to the market maker. This account must be owned by the DFlow program, and this account must be initialized by calling the initialize market maker instruction. This account is expected to be zeroed out upon the start of instruction processing
Returns
TransactionInstructionThis function returns an instruction to include in the transaction.
def init_recovery_vault(dflow, recovery_vault_mint, auction_owner):

This instruction creates a recovery vault.

Recovery vaults are required for all mints used in the protocol. If a transfer recipient does not have a token account set up, the transferor can direct the protocol to transfer the tokens to the recovery vault. The intended recipient can then recover the tokens by submitting a recovery claim.

Parameters
dflow:ProgramUndocumented
recovery_vault_mint:PublicKeyThe public key of the recovery_vault_mint account.
auction_owner:PublicKeyThe public key of the auction_owner account.
Returns
TransactionInstructionThis function returns an instruction to include in the transaction.
def init_retail_account(dflow, max_orders_supported, retail_data_account, retail_account_owner):

This instruction initializes the retail traders account.

The retail data account tracks state specific to the retail trader's trading activities on DFlow.

Parameters
dflow:ProgramUndocumented
max_orders_supported:intThe maximum number of orders allowed to be active at once by a retail trader
retail_data_account:PublicKeyThe retail data account holds state specific to the retail trader. This account is expected to be zeroed out upon the start of instruction processing
retail_account_owner:PublicKeyThe public key of the retail trader. This account is a signer for the instruction
Returns
TransactionInstructionThis function returns an instruction to include in the transaction.
def init_signatory_system(dflow, signatory_stake_mint, dflow_admin):

This instruction is used to initialize global state for tracking the system of signatory servers.

This instruction can only be called by the DFlow admin and can only be called once.

Parameters
dflow:ProgramUndocumented
signatory_stake_mint:PublicKeyThe SPL mint account associated with the token that is staked by the signatory server.
dflow_admin:PublicKeyThe public key of the DFlow admin. This account is a signer for the instruction. This account is expected to be mutable
Returns
TransactionInstructionThis function returns an instruction to include in the transaction.
def new_order(dflow, retail_account_owner, retail_data_account_nonce, auction_id, auction_epoch, previous_auction_epoch, signatory_server, retail_encryption_pub_key, mm_encryption_pub_key, encrypted_order_details, retail_signing_pub_key, retail_signature, deposit_amount, order_type, retail_x_token_account, rebate_receiver_token_account, retail_data_account, market_maker_data_account, x_mint, price_oracles):

This instruction is called by retail traders when they submit their order. A transaction containing this instruction must be signed by a signatory server.

When submitting orders, retail traders must encrypt the details of their order in order to hide information regarding which token is being received.

Parameters
dflow:ProgramUndocumented
retail_account_owner:PublicKeyThe public key of the retail_account_owner account.
retail_data_account_nonce:intThe unsigned integer field named nonce in the retail_data_account account. The nonce in the retail trader's account used to generate a PDA for the vault token account. This nonce must be saved and used when referencing this order in the future.
auction_id:intAn unsigned 64 bit integer. The auction ID used as a seed to generate the program derived address
auction_epoch:intAn unsigned 64 bit integer. The integer epoch used to generate the PDA of the auction epoch account
previous_auction_epoch:intAn unsigned 64 bit integer. The previous epoch. This must be equal to auction_epoch - 1.
signatory_server:PublicKeyThe public key of the signatory_server account.
retail_encryption_pub_key:List[int]The retail trader's X25519 public key.
mm_encryption_pub_key:List[int]The market maker's X25519 public key.
encrypted_order_details:strThe ciphertext of the order details, encrypted using a 24-byte nonce of zeros and the key derived from the market maker's X25519 public key and the retail trader's X25519 private key.
retail_signing_pub_key:List[int]The public key of the Ed25519 key pair that the retail trader used to generate the signature.
retail_signature:List[int]The signature of the plaintext order details.
deposit_amount:intThe amount of tokens being sent by the retail trader in the trade.
order_type:intThe order type, must be either 0 for limit or 1 for market. All other values result in a failed transaction.
retail_x_token_account:PublicKeyThe SPL token account associated with the retail trader which is used to deposit the sold token into escrow prior to the trade occurring. This account is expected to be mutable
rebate_receiver_token_account:PublicKeyThe SPL token account associated with the order used to receive a payment from the network, with the same mint as the token accounts used by market makers to bid in the associated auction.
retail_data_account:PublicKeyThe retail data account holds state specific to the retail trader. This account is expected to be mutable
market_maker_data_account:PublicKeyThe account storing state specific to the market maker. This account must be owned by the DFlow program, and this account must be initialized by calling the initialize market maker instruction. This account is expected to be mutable
x_mint:PublicKeyThe SPL mint account associated with the token that is sold by the retail trader during the swap.
price_oracles:List[PublicKey]These price oracles are the Pyth price accounts associated with the products that could possibly be received by the retail trader based on which token they are selling. For example, if a retail trader is swapping X for some other token, then the price oracles that must be passed here are all price oracles which exist as a pair with X in this auction.
Returns
TransactionInstructionThis function returns an instruction to include in the transaction.
def reclaim_auction_bid(dflow, auction_id, auction_epoch, market_maker_data_account, market_maker_account_owner, market_maker_auction_token_account):

This instruction is called by the market maker to withdraw its losing auction bids and close its bid record account for the given auction.

A market maker who is outbid in an auction can use this instruction to withdraw its bids in the auction and close its bid record account for the auction. A market maker who has won an auction can use this instruction to close its bid record account for the auction.

Parameters
dflow:ProgramUndocumented
auction_id:intAn unsigned 64 bit integer. The auction ID used as a seed to generate the program derived address
auction_epoch:intAn unsigned 64 bit integer. The integer epoch used to generate the PDA of the auction epoch account
market_maker_data_account:PublicKeyThe public key of the market_maker_data_account account.
market_maker_account_owner:PublicKeyThe public key of the market_maker_account_owner account.
market_maker_auction_token_account:PublicKeyThe SPL token account associated with the market maker used to bid in the auctions. This account is expected to be mutable
Returns
TransactionInstructionThis function returns an instruction to include in the transaction.
def revoke_role(dflow, principal, role, dflow_admin):

This instruction revokes the specified role from the principal and closes the principal's whitelist account if it no longer grants any permissions.

Parameters
dflow:ProgramUndocumented
principal:PublicKeyThe public key of the principal account.
role:intThe role to revoke from the principal.
dflow_admin:PublicKeyThe public key of the DFlow admin. This account is a signer for the instruction. This account is expected to be mutable
Returns
TransactionInstructionThis function returns an instruction to include in the transaction.
def set_new_dflow_admin(dflow, dflow_admin, new_dflow_admin):

This instruction updates the DFlow admin.

The current DFlow admin can use this instruction to assign a new DFlow admin.

Parameters
dflow:ProgramUndocumented
dflow_admin:PublicKeyThe public key of the DFlow admin. This account is a signer for the instruction
new_dflow_admin:PublicKeyThe new DFlow admin's public key.
Returns
TransactionInstructionThis function returns an instruction to include in the transaction.
def stake_signatory(dflow, signatory_server, stake_size, signatory_server_token_account):

This instruction is used to stake additional tokens into an existing signatory server stake vault.

Signatory servers are subject to slashing, and if slashed to below the stake minimum they may no longer be qualified to endorse order flow as originated from a retail source.

Parameters
dflow:ProgramUndocumented
signatory_server:PublicKeyThe public key of the signatory_server account.
stake_size:intThe amount of signatory 'stake mint' tokens to stake
signatory_server_token_account:PublicKeyThe signatory server's token account used for originating the stake transfer. This account is expected to be mutable
Returns
TransactionInstructionThis function returns an instruction to include in the transaction.
def submit_auction_bid(dflow, auction_id, auction_epoch, next_auction_epoch, market_maker_data_account, market_maker_account_owner, bid_size, market_maker_auction_token_account):

This instruction is called by the market maker to bid in an auction.

When a market maker wishes to bid in an auction, they can use this instruction to specify the parameters of their bid. Note that the first bidder in auction epoch N must ensure that auction epoch state accounts are initialized for auction epochs N and N + 1.

Parameters
dflow:ProgramUndocumented
auction_id:intAn unsigned 64 bit integer. The auction ID used as a seed to generate the program derived address
auction_epoch:intAn unsigned 64 bit integer. The integer epoch used to generate the PDA of the auction epoch account
next_auction_epoch:intAn unsigned 64 bit integer. The next auction epoch number. If bidding in auction epoch N, this must be N + 1.
market_maker_data_account:PublicKeyThe public key of the market_maker_data_account account.
market_maker_account_owner:PublicKeyThe public key of the market_maker_account_owner account.
bid_size:intThe size of the bid being placed into the auction. This number must strictly exceed the best bid in order for the transaction to be executed.
market_maker_auction_token_account:PublicKeyThe SPL token account associated with the market maker used to bid in the auctions. This account is expected to be mutable
Returns
TransactionInstructionThis function returns an instruction to include in the transaction.
def update_encryption_key(dflow, market_maker_account_owner, encryption_pub_key, market_maker_data_account):

This instruction updates the market maker's 256-bit X25519 public key.

Retail traders use the market maker's 256-bit X25519 public key to encrypt their order details when routing orders to the market maker. This instruction updates the market maker's X25519 public key.

Parameters
dflow:ProgramUndocumented
market_maker_account_owner:PublicKeyThe public key of the market_maker_account_owner account.
encryption_pub_key:List[int]The market maker's 256-bit X25519 public key which will be used by retail traders to encrypt their order details
market_maker_data_account:PublicKeyThe account storing state specific to the market maker. This account must be owned by the DFlow program, and this account must be initialized by calling the initialize market maker instruction. This account is expected to be mutable
Returns
TransactionInstructionThis function returns an instruction to include in the transaction.