# Processing Orders

### Overview:

Each user's subscription (deposit) or redemptions (redeem) are tracked as a records in the smart contract. The epoch at which they issued their order is saved along with the amount of assets (stablecoins) or shares (fund tokens) they sent to the fund smart contract for processing. Once the price in the smart contract is updated, all users that placed their orders before the investment cutoff are able to process their deposits and redemptions.

Processing user orders is done via a permissionless function call. Anyone willing to pay the gas can process any users orders as assets or shares have already been received by the smart contract. If a user's order is not in a state where it can be processed depending on the epoch of the smart contract or otherwise the call will simply fail.

### Deposits:

Users send stablecoins into the fund smart contract and have a deposit record saved. Once the administrator updates the price and ends the epoch, users who invested before **drain** was called by the administrator are granted their shares based on the amount of capital the fund received.

### Redemptions:

Shareholders are able to burn their shares to make a redemption order. Once liquidity is available to the fund administrator they deposit those stablecoins into the fund. Redemptions can be satisfied upon the next price update, pro-rata of available liquidity, if there is not enough liquidity to fulfill all orders.

### Drain:

The cutoff for users who will receive their shares on the next price update or the one following it depending on if they got in before or after that call by the admin. This prevents issues of front-running the price update, as well as ensuring the accurate price and share issuance calculations.

### Update:

The fund administrator sets a new price per share, incrementing the epoch, which locks in the newly minted shares.

### Refill:

All the stablecoin capital added to the fund smart contract with this call is made available for redemptions. Orders that come into redeem shares receive their USDC back on a pro-rata basis, and any deposited USDC from subscriptions is not available for those orders.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.fortunafi.com/technical-resources/processing-orders.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
