> For the complete documentation index, see [llms.txt](https://sovavault.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sovavault.gitbook.io/docs/technical-resources/detailed-protocol-flows.md).

# Detailed Protocol Flows

### **1. Strategy Deployment Flow**

**Call Chain:**

```
Registry.deploy(implementation, name, symbol, asset, assetDecimals, manager, initData)
```

* Checks authorization
* Deploys strategy using minimal proxy
* Initializes strategy and tRWA token
* Registers deployed strategy

**State Changes:**

* Registry registers strategy
* Strategy instance is initialized
* Token and (optionally) escrow are deployed

**Events:**

* `Deploy(strategy, token, asset)`
* `StrategyInitialized(admin, manager, asset, sToken)`
* `SetReporter(reporter)`

***

### **2. Standard Deposit Flow**

**Call Chain:**

```
tRWA.deposit(assets, receiver)
```

* Calculates shares
* Runs deposit hooks
* Transfers assets via Conduit
* Mints shares

**State Changes:**

* `totalSupply` increases
* Receiver's balance updated
* Assets transferred

**Events:**

* `Deposit(sender, receiver, assets, shares)`

***

### **3. Standard Withdrawal Flow**

**Call Chain:**

```
tRWA.withdraw(assets, receiver, owner)
// or
tRWA.redeem(shares, receiver, owner)
```

* Runs withdrawal hooks
* Burns shares
* Transfers assets

**State Changes:**

* `totalSupply` decreases
* Owner's balance updated
* Assets transferred

**Events:**

* `Withdraw(sender, receiver, owner, assets, shares)`
* `WithdrawalQueued(withdrawalId, owner, assets, shares)` (if queued)

***

### **4. Two-Phase Deposit Flow (GatedMintRWA)**

**Deposit Request Phase:**

```
GatedMintRWA.requestDeposit(assets, receiver)
```

* Runs deposit hooks
* Transfers assets to escrow
* Emits `DepositPending`

**Accept Flow:**

```
GatedMintEscrow.acceptDeposit(depositId)
```

* Moves assets to strategy
* Calls `mintShares`
* Emits `DepositAccepted`

**Reject Flow:**

```
GatedMintEscrow.refundDeposit(depositId)
```

* Returns assets to depositor
* Emits `DepositRefunded`

**Events:**

* `DepositPending`
* `DepositAccepted` / `BatchDepositsAccepted`
* `DepositRefunded` / `BatchDepositsRefunded`

***

### **5. KYC / Compliance Validation Flow**

**KYC Setup:**

```
KycRulesHook.allow(account)
KycRulesHook.deny(account)
```

* Modifies allowlist/denylist

**Validation on Token Operations:**

* Runs hooks: `onBeforeTransfer`, `onBeforeDeposit`, `onBeforeWithdraw`
* Checks sender/receiver permissions

**Events:**

* `AddressAllowed`
* `AddressDenied`
* `AddressRestrictionRemoved`
