> For the complete documentation index, see [llms.txt](https://docs.xft.finance/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.xft.finance/bitnet/use-cases/drs/transferagentmodule_v5.md).

# TransferAgentModule\_V5

## TransferAgentModule\_V5

This contract is an on-chain **transfer agent** for a tokenized money market fund (like FOBXX). It handles:

### Core Operations

#### 1. **Dividend Distribution**

```
dividendShares = (balance × rate) / price
```

* Positive rate → mint shares (yield)
* Negative rate → burn shares (rare negative yield)

#### 2. **Transaction Settlement**

Processes pending buy/sell orders:

* **Purchases** (AIP, cash) → mint shares: `shares = (cashAmount × scaleFactor) / NAV`
* **Liquidations** → burn shares, return cash value
* **Transfers** → move shares between accounts

#### 3. **End of Day** (combined operation)

Dividends + settlements in one call—typical daily batch.

***

### Example: FOBXX Daily Operations

**Morning:** Investors submit orders (stored in TransactionalModule)

**4PM NAV published:** $1.0002/share, daily rate = 0.00014 (5.1% APY)

**Admin calls `endOfDay`:**

```
accounts: [0xAlice, 0xBob, 0xCarol]
txIds: [pending orders to skip if needed]
date: 1736380800  // today
rate: 140000000000000  // 0.014% scaled
price: 1000200000000000000  // $1.0002 scaled
```

**For Alice (holds 10,000 shares, pending $5,000 purchase):**

1. Dividend: `10000 × rate / price` → \~1.4 shares minted
2. Settlement: `$5000 / $1.0002` → \~4,999 shares minted

***

### Admin Controls

| Function               | Purpose                             |
| ---------------------- | ----------------------------------- |
| `adjustBalance`        | Fix errors manually                 |
| `recoverAccount`       | Transfer entire balance (lost keys) |
| `recoverAsset`         | Partial recovery                    |
| `settleCXTransactions` | Cross-chain transfers               |

All functions require admin role and emit detailed events for audit trail.
