> For the complete documentation index, see [llms.txt](https://docs.elara.fi/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.elara.fi/architecture/contract-architecture/minting-redeeming.md).

# Minting & Redeeming

ELUSD is minted when a user deposits an accepted stablecoin into the Vault, and burned when a user redeems it back for collateral. Both operations are priced through the oracle.

## Supported collateral

| Token | Mainnet address                              | Decimals |
| ----- | -------------------------------------------- | -------- |
| USDC  | `0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48` | 6        |
| USDT  | `0xdAC17F958D2ee523a2206206994597C13D831ec7` | 6        |
| USDe  | `0x4c9EDD5852cd905f086C759E8383e09bff1E68B3` | 18       |

## Fees

| Fee             | Contract rate          | Currently Charged |
| --------------- | ---------------------- | ----------------- |
| Performance fee | 30% of yield generated | No, waived        |
| Management fee  | 1% per annum           | No, waived        |

Elara and Arken have both waived management and performance fees as a joint growth measure. The contracts carry the mechanism and the rates above, but neither party currently earns them. Contract-level amounts and redemption adjustments are retained or recycled within the system rather than paid out as revenue. Fees will return once the fee model is reworked.

Mint and redeem fees (in basis points) are configurable per token by the `CONTRACT_ADMIN` role.

***

## Minting

**Function:** `Vault.mint(address token, address to, uint256 amount)`

The caller deposits `amount` of `token`; the Vault mints the corresponding ELUSD to `to`.

### Pre-conditions

1. `token` must be registered and have minting enabled in `TokenRegistry`.
2. The Vault must not be paused.

### Price & peg protection

The Vault fetches the stablecoin price from `PriceOracle`, which reads from the configured Chainlink feed. Before calculating the ELUSD amount, the Vault **caps the price at $1**:

```
effectivePrice = min(oraclePrice, $1)
```

This ensures a stablecoin trading above peg cannot be used to mint more ELUSD than the deposited USD value warrants.

### Amount calculation

```
elUSDAmount = (amount × effectivePrice × 10^18) / (10^tokenDecimals × 10^18)
mintFee     = elUSDAmount × mintFeeBps / 10_000
netMinted   = elUSDAmount − mintFee
```

### Token flow

```mermaid
sequenceDiagram
    participant User
    participant Vault
    participant TokenRegistry
    participant PriceOracle
    participant TreasuryAdapter
    participant ElUSD

    User->>Vault: mint(token, to, amount)
    Vault->>TokenRegistry: getTokenConfig(token)
    Vault->>PriceOracle: getPrice(token)
    PriceOracle-->>Vault: price (18 dec)
    Vault->>Vault: cap price at $1, compute ELUSD & fee
    Vault->>TreasuryAdapter: transferIn(token, user, netAmount)
    Note over TreasuryAdapter: collateral moves to treasury
    Vault->>ElUSD: mint(to, netMinted)
    ElUSD-->>User: ELUSD received
```

***

## Redeeming

**Function:** `Vault.redeem(address token, address to, uint256 elUSDAmount)`

The caller burns `elUSDAmount` of ELUSD and receives `token` collateral at `to`.

### Pre-conditions

1. `token` must be registered and have redemption enabled.
2. The Vault must not be paused.

### Price & peg protection

The Vault **floors the collateral price at $1** for redemptions:

```
effectivePrice = max(oraclePrice, $1)
```

If a stablecoin depegs below $1, users still receive the face-value amount of collateral; they cannot extract excess tokens by exploiting a temporary depeg.

### Amount calculation

```
tokenAmount = (elUSDAmount × 10^tokenDecimals) / effectivePrice
redeemFee   = tokenAmount × redeemFeeBps / 10_000
netReceived = tokenAmount − redeemFee
```

### Instant vs. queued redemption

The Vault checks treasury liquidity before completing the redemption:

| Condition                                     | Outcome                                                  |
| --------------------------------------------- | -------------------------------------------------------- |
| Treasury has sufficient balance and allowance | Instant settlement: ELUSD burned, collateral transferred |
| Insufficient liquidity                        | Redemption queued: ELUSD held in Vault until settled     |

Queued redemptions emit a `RedeemQueued` event and are persisted in `queuedRedemptions` against a redemption ID. Once treasury liquidity is available, settlement is executed by an authorised role calling `Vault.settleRedemption(redemptionId)`, which burns the held ELUSD and transfers collateral to the recipient. The entry is deleted on settlement.

Note the asymmetry: `redeem` is permissionless and callable by any holder, while `settleRedemption` is restricted.

### Token flow

```mermaid
sequenceDiagram
    participant User
    participant Vault
    participant Oracle
    participant ElUSD
    participant TreasuryAdapter

    User->>Vault: redeem(token, to, elUSDAmount)
    Vault->>Vault: Token config check
    Vault->>Oracle: getPrice(token)
    Oracle-->>Vault: price (18 dec)
    Vault->>Vault: floor price at $1, compute token amount & fee
    User->>Vault: transfer elUSDAmount to Vault

    alt Sufficient liquidity
        Vault->>ElUSD: burn(vault, elUSDAmount)
        Vault->>TreasuryAdapter: transferOut(token, to, netReceived)
        Vault-->>User: emit RedeemSettled
    else Insufficient liquidity
        Vault->>Vault: store in queuedRedemptions
        Vault-->>User: emit RedeemQueued
        Note over Vault: ELUSD held in Vault until settled
    end
```

***

## Full exit path

A user holding sELUSD takes two steps to exit fully:

1. **Unstake**: call `ElUSDStake.unstake(shares)` to burn sELUSD and receive ELUSD at the current share price.
2. **Redeem**: call `Vault.redeem(token, to, elUSDAmount)` to exchange ELUSD for the underlying stablecoin.

There is no minimum redemption amount.

## Key events

| Event                                       | Emitted by | When                                            |
| ------------------------------------------- | ---------- | ----------------------------------------------- |
| `Minted(token, from, to, amount, fee)`      | `Vault`    | Successful mint                                 |
| `RedeemSettled(id, token, to, amount, fee)` | `Vault`    | Instant or deferred redemption completed        |
| `RedeemQueued(id, token, to, elUSDAmount)`  | `Vault`    | Redemption queued due to insufficient liquidity |
