Structs

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

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.

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.

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.

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.

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.

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.

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.

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.

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.

This instruction grants the specified role to the principal.

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

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.

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.

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.

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.

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.

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.

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.

This instruction initializes the retail traders account. The retail data account tracks state specific to the retail trader’s trading activities on DFlow.

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.

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.

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.

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

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

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.

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.

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.