107 lines
2.9 KiB
Markdown
107 lines
2.9 KiB
Markdown
|
|
# CBDC Wallet Transfer Flow
|
||
|
|
|
||
|
|
## Overview
|
||
|
|
|
||
|
|
CBDC wallet transfers enable movement of CBDC between wallets with compliance checks and balance verification. This flow documents the complete transfer process.
|
||
|
|
|
||
|
|
## Prerequisites
|
||
|
|
|
||
|
|
- Source and destination wallets exist and are active
|
||
|
|
- Sufficient balance in source wallet
|
||
|
|
- Compliance checks pass
|
||
|
|
- CBDC transaction service operational
|
||
|
|
|
||
|
|
## Visual Flow Diagram
|
||
|
|
|
||
|
|
```
|
||
|
|
┌─────────────┐
|
||
|
|
│ Transfer │
|
||
|
|
│ Request │
|
||
|
|
└──────┬──────┘
|
||
|
|
│
|
||
|
|
│ 1. Validate Wallets
|
||
|
|
▼
|
||
|
|
┌─────────────────────────┐
|
||
|
|
│ Validate Wallets │
|
||
|
|
│ - Source wallet │
|
||
|
|
│ - Destination wallet │
|
||
|
|
│ - Balance check │
|
||
|
|
└──────┬──────────────────┘
|
||
|
|
│
|
||
|
|
│ 2. Compliance Check
|
||
|
|
▼
|
||
|
|
┌─────────────────────────┐
|
||
|
|
│ Compliance Check │
|
||
|
|
│ - AML screening │
|
||
|
|
│ - KYC verification │
|
||
|
|
└──────┬──────────────────┘
|
||
|
|
│
|
||
|
|
│ 3. Execute Transfer
|
||
|
|
▼
|
||
|
|
┌─────────────────────────┐
|
||
|
|
│ Execute Transfer │
|
||
|
|
│ - Update balances │
|
||
|
|
│ - Create transaction │
|
||
|
|
└──────┬──────────────────┘
|
||
|
|
│
|
||
|
|
│ 4. Complete
|
||
|
|
▼
|
||
|
|
┌─────────────┐
|
||
|
|
│ Transfer │
|
||
|
|
│ Complete │
|
||
|
|
└─────────────┘
|
||
|
|
```
|
||
|
|
|
||
|
|
## Step-by-Step Process
|
||
|
|
|
||
|
|
### Step 1: Validate Wallets
|
||
|
|
1. Lookup source wallet
|
||
|
|
2. Lookup destination wallet
|
||
|
|
3. Verify both wallets are active
|
||
|
|
4. Check source wallet balance
|
||
|
|
5. Verify sufficient funds
|
||
|
|
|
||
|
|
**Code Reference**: `src/core/cbdc/cbdc-wallet.service.ts`
|
||
|
|
|
||
|
|
### Step 2: Compliance Check
|
||
|
|
1. Run AML screening
|
||
|
|
2. Verify KYC status
|
||
|
|
3. Check transaction limits
|
||
|
|
4. If compliance fails, reject transfer
|
||
|
|
|
||
|
|
**Code Reference**: `src/core/compliance/aml.service.ts`
|
||
|
|
|
||
|
|
### Step 3: Execute Transfer
|
||
|
|
1. Create transaction record
|
||
|
|
2. Update source wallet balance (debit)
|
||
|
|
3. Update destination wallet balance (credit)
|
||
|
|
4. Post to ledger
|
||
|
|
5. Return transaction ID
|
||
|
|
|
||
|
|
**Code Reference**: `src/core/cbdc/cbdc-transaction.service.ts`
|
||
|
|
|
||
|
|
## Error Handling
|
||
|
|
|
||
|
|
- Wallet not found: Return error
|
||
|
|
- Insufficient balance: Return error
|
||
|
|
- Compliance failure: Reject transfer
|
||
|
|
- Ledger posting failure: Rollback balances
|
||
|
|
|
||
|
|
## Integration Points
|
||
|
|
|
||
|
|
- CBDC Wallet Service: `src/core/cbdc/cbdc-wallet.service.ts`
|
||
|
|
- CBDC Transaction Service: `src/core/cbdc/cbdc-transaction.service.ts`
|
||
|
|
- AML Service: `src/core/compliance/aml.service.ts`
|
||
|
|
|
||
|
|
## Performance Metrics
|
||
|
|
|
||
|
|
- Total End-to-End: < 150ms target
|
||
|
|
- Throughput: 10,000+ transfers/second
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
**Related Flows**:
|
||
|
|
- [CBDC Mint Burn Flow](./cbdc-mint-burn-flow.md)
|
||
|
|
- [AML Screening Flow](./aml-screening-flow.md)
|
||
|
|
|