# Users & Depositors

## Overview

Ocean Finance provides multiple interfaces for users to interact with the protocol, from basic OCUSD minting to advanced staking strategies. The protocol is designed to accommodate different user types and risk preferences.

## User Flow Diagram

![User Flow Diagram](/files/TQOiAgYUAAMW3iMAsRgJ)

## User Interface Functions

### Minting OCUSD

Users interact with the `MintingManager` to convert collateral assets into OCUSD:

```solidity
function mint(
    address asset,           // Collateral asset (USDC, USDT, etc.)
    uint256 amount,         // Amount of collateral
    address receiver        // Recipient of OCUSD
) external returns (uint256 ocusdAmount)
```

**Requirements**:

* User must be whitelisted as a minter (or public minting enabled)
* Asset must be supported by the protocol
* Contract must not be paused
* Sufficient asset allowance to MintingManager

**Process**:

1. Transfers collateral from user to StrategyAllocator
2. Gets current asset price from OceanOracle
3. Calculates OCUSD amount based on collateral value
4. Mints OCUSD to specified receiver

### Permit-Based Minting

For improved UX, users can mint without prior approvals using EIP-2612 permits:

```solidity
function mintWithPermit(
    address asset,
    uint256 amount,
    address receiver,
    uint256 deadline,
    uint8 v,
    bytes32 r,
    bytes32 s
) external returns (uint256 ocusdAmount)
```

### Staking OCUSD

Users can stake OCUSD in the `StakedOCUSD` vault to earn additional yield:

#### Standard ERC4626 Functions

```solidity
function deposit(uint256 assets, address receiver) external returns (uint256 shares)
function mint(uint256 shares, address receiver) external returns (uint256 assets)
function withdraw(uint256 assets, address receiver, address owner) external returns (uint256 shares)
function redeem(uint256 shares, address receiver, address owner) external returns (uint256 assets)
```

#### Cooldown-Based Withdrawals

When cooldown is enabled, users must use the two-step withdrawal process:

```solidity
// Step 1: Initiate cooldown
function cooldownAssets(uint256 assets) external returns (uint256 shares)
function cooldownShares(uint256 shares) external returns (uint256 assets)

// Step 2: Claim after cooldown period
function unstake(address receiver) external returns (uint256 assets)
```

### Redemption Process

OCUSD redemption uses an asynchronous request-fulfill system for security and liquidity management:

#### Step 1: Request Redemption

```solidity
function requestRedeem(
    address asset,          // Desired collateral asset
    uint256 ocusdAmount    // Amount of OCUSD to redeem
) external returns (uint256 requestId)
```

**Process**:

* Transfers OCUSD from user and locks it in contract
* Creates redemption request with unique ID
* Emits `RedeemRequested` event

#### Step 2: Admin Fulfillment

```solidity
function fulfillRedeemRequest(uint256 requestId) external onlyServiceRole
```

**Process**:

* Burns locked OCUSD
* Transfers requested collateral to user
* Marks request as fulfilled

#### Cancel Redemption

```solidity
function cancelRedeemRequest(uint256 requestId) external
```

Users can cancel unfulfilled requests and recover their locked OCUSD.

## User Types and Strategies

### 1. Basic Users

**Profile**: Users seeking simple yield exposure **Strategy**: Mint OCUSD and hold for passive yield **Benefits**:

* Auto-compounding yield from diversified strategies
* No active management required
* Cross-chain transferability

### 2. Active Stakers

**Profile**: Users seeking maximum yield **Strategy**: Mint OCUSD → Stake in StakedOCUSD **Benefits**:

* Base OCUSD yield + additional $OCEAN rewards
* Compounding from both sources
* Governance participation (potential future feature)

### 3. Liquidity Providers

**Profile**: DeFi users providing protocol liquidity **Strategy**: Use OCUSD in external AMMs and protocols **Benefits**:

* Trading fees from AMM pools
* Additional incentives from partner protocols
* Maintained exposure to OCUSD yield

### 4. Cross-Chain Users

**Profile**: Multi-chain DeFi participants **Strategy**: Bridge OCUSD to different chains **Benefits**:

* Access to chain-specific yield opportunities
* Unified yield-bearing asset across ecosystems
* Reduced bridging complexity

## User Experience Optimizations

### Gas Efficiency

* Batch operations where possible
* Permit-based transactions to eliminate approvals
* Efficient share calculation in StakedOCUSD

### Security Features

* Cooldown periods for large withdrawals
* Oracle validation for all pricing
* Emergency pause mechanisms
* Comprehensive access controls

### Yield Optimization

* 24-hour yield vesting prevents manipulation
* Auto-compounding in StakedOCUSD
* Real-time yield allocation across strategies
* Transparent fee structure

## User Monitoring and Analytics

### On-Chain Data

* Real-time OCUSD balance and yield accrual
* Staking positions and rewards
* Redemption request status
* Transaction history

### Key Metrics for Users

* Current APY across strategies
* Total Value Locked (TVL)
* Strategy allocation percentages
* Fee breakdown and protocol revenue

### Risk Indicators

* Strategy performance metrics
* Oracle deviation alerts
* Protocol utilization rates
* External protocol health scores

## Emergency Procedures

### Protocol Pauses

* Minting can be paused by admins
* Existing positions remain functional
* Withdrawals and redemptions continue

### Strategy Failures

* Individual strategy handlers can be disabled
* Funds can be emergency withdrawn to StrategyAllocator
* Users maintain full OCUSD backing

### Oracle Issues

* Fallback oracle mechanisms
* Price staleness detection
* Admin override capabilities for critical situations

This comprehensive user interface ensures that Ocean Finance can serve diverse user needs while maintaining security, efficiency, and transparency throughout all user interactions.


---

# 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.ocean.fi/protocol-architecture/04-protocol-architecture/users-depositors.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.
