# SignatureDepositQueue

### Purpose

`SignatureDepositQueue` extends `SignatureQueue` to enable **instant deposit** of assets into a vault, bypassing the standard on-chain `DepositQueue` mechanism. It leverages **off-chain approvals** signed by a trusted consensus group, using **EIP-712** or **EIP-1271**-compliant signatures, to authorize asset inflows and minting of vault shares.

This contract is optimized for high-trust environments requiring immediate asset onboarding while maintaining on-chain price safety guarantees.

### Key Features

* **Instant deposit execution** with no queuing delay
* **EIP-712 signed orders** with nonce-based replay protection
* **Vault share minting** at off-chain pre-agreed price
* **Fully integrated with vault accounting and share manager**
* **No deposit fee** applied (unlike possible fees in `DepositQueue`)

### Workflow

1. A consensus group signs an `Order` authorizing a user deposit:
   * Includes asset amount (`ordered`) and shares to mint (`requested`)
   * Binds the request to a specific queue and vault
   * Includes a nonce and expiration timestamp
2. User submits the order on-chain by calling `deposit` function:
   * The contract validates the order using signatures and price logic
   * Receives tokens from the user
   * Transfers these tokens to the vault
   * Mints shares to the specified recipient
   * Updates vault internal balance and executes post-deposit hook

### Function: `deposit`

```solidity
function deposit(Order calldata order, IConsensus.Signature[] calldata signatures) external payable nonReentrant
```

### Parameters:

* `order`: A signed `Order` struct including deposit parameters
* `signatures`: Signatures from the off-chain consensus validating the order

### Steps:

1. `validateOrder(...)`:
   * Confirms order is not expired
   * Confirms order is intended for this queue
   * Confirms correct asset, caller, and nonce
   * Validates off-chain signatures
   * Computes and validates asset/share price using vault oracle
2. Increments the caller’s nonce to prevent replay
3. Transfers `order.ordered` assets from the caller to this contract
4. Transfers these assets into the vault
5. Calls `vault.callHook(...)` for any optional strategy logic
6. Notifies the vault's `RiskManager` of the new deposit
7. Mints `order.requested` shares to `order.recipient`
8. Emits `OrderExecuted` event

### Security Considerations

* **Consensus signatures** are required to prevent unauthorized deposits
* **Oracle validation** ensures price sanity even in trusted setups
* **Replay protection** enforced using per-user nonces
* No deposit can proceed if:
  * Asset or queue mismatch
  * Caller mismatch
  * Nonce is reused
  * Off-chain price is out of oracle bounds


---

# 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://metavaults.mellow.finance/architecture/queues/signaturedepositqueue.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.
