Investor Deposit Flow
This document details the mechanics of the deposit flow within the King's Vault system, which uses a dual-pricing mechanism to prevent arbitrage and ensure anti-dilution.
Sequence Diagram
When an investor deposits into the vault, the vault calculates the required shares using the dual-pricing logic before transferring the assets.
sequenceDiagram
participant Investor
participant Asset as ERC20 Asset
participant Vault
participant Controller
Investor->>Asset: approve(Vault, assets)
Investor->>Vault: deposit(assets, receiver)
Vault->>Controller: markedValues(vault)
Vault->>Vault: calculate shares with dual pricing
Vault->>Asset: transferFrom(investor, vault, assets)
Vault->>Vault: mint shares to receiver
Requirements
The vault enforces several restrictions before allowing a deposit to succeed:
| Requirement | Source |
|---|---|
| Vault not paused | _deposit(... whenNotPaused) |
| Vault not shutdown | _deposit(... whenNotShutdown) |
Caller has Roles.INVESTOR on vault |
_deposit(... onlyRole(Roles.INVESTOR)) |
Additionally, the ERC-4626 view functions maxDeposit(receiver) and maxMint(receiver) return 0 if the vault is paused, shutdown, or the receiver lacks Roles.INVESTOR, providing front-ends an easy way to check eligibility.