# Audits & Verification

Morfa clearly separates the security assurance of **immutable third-party infrastructure** (Morpho and OpenZeppelin) from **Morfa's own smart contract and application code**. Never mistake an audit of underlying Morpho contracts for a manual audit of custom application components.

***

## Security Assurance by Layer

| Component | Mode | Assurance & Audit Status | Verification Link |
| --- | --- | --- | --- |
| **Morpho Blue, Morpho Vault V2, `MorphoMarketV1AdapterV2`, `AdaptiveCurveIRM`** | Mode B & Mode A | Multiple independent tier-1 security audits, **Certora formal verification**, and an active **Cantina `$2.5M` bug bounty** program maintained by Morpho. | [Morpho Audits & Security](https://docs.morpho.org/get-started/resources/audits) |
| **OpenZeppelin Contracts v5** (`AccessControlDefaultAdminRules`, `Pausable`, `ReentrancyGuardTransient`, `SafeERC20`, `Math.mulDiv`, `SafeCast`, `Time`, `EnumerableSet`) | Mode A (`MorfaRebalancer`) | Industry-standard, widely audited Solidity library primitives. | [OpenZeppelin Contracts](https://github.com/OpenZeppelin/openzeppelin-contracts) |
| **`MorfaRebalancer.sol`** (`0x2135...9cfA`) | Mode A only | Verified on Etherscan V2 & Sourcify (`exact_match`), reviewed via **Nethermind AuditAgent** automated scan #3 (`0 High`, `1 Medium (Acknowledged)`, `0 Low`), Slither `0.11.5`, and Hardhat 3 unit/fuzz/Mainnet fork tests. | [AuditAgent PDF Report](https://github.com/Rolaman/morfa-contracts/blob/main/audits/auditagent-scan-3-2026-12-06.pdf) · [Summary](https://github.com/Rolaman/morfa-contracts/blob/main/audits/README.md) · [Source](https://github.com/Rolaman/morfa-contracts/blob/main/contracts/MorfaRebalancer.sol) |
| **`morfa-worker` & `morfa-app`** | Mode B & Mode A | Noncustodial off-chain orchestration and UI; cannot bypass on-chain Morpho Vault V2 caps or `MorfaRebalancer` invariants; covered by automated TypeScript tests and mandatory `eth_call` pre-flight simulation. | Verify on-chain txs on [Etherscan](https://etherscan.io/address/0x2c7CB5D2f34e547d3EadbeF116f97D2e2A92DCAc) |

***

## Mode B (`Morfa Vault / mfUSDC`) Assurance

Mode B introduces **zero custom Solidity contracts** in the custody or accounting path. Every deposit, share mint, allocation, and withdrawal runs strictly inside official immutable **Morpho Vault V2**, **`MorphoMarketV1AdapterV2`**, and **Morpho Blue** bytecode deployed from Morpho's official factories.

You can independently verify the Morfa Vault V2 deployment factory (`0xA1D94F746dEfa1928926b84fB2596c06926C0405`), verified source code, live adapters, caps, and timelocks directly on [Etherscan](https://etherscan.io/address/0xfde07Bd3A0e514e7216239Ecd31c51a2400B99c9) and [Morpho App](https://app.morpho.org/).

***

## Mode A (`MorfaRebalancer.sol`) Assurance & Transparency

### Nethermind AuditAgent Report (Scan #3, December 6, 2026)

`MorfaRebalancer.sol` ([`0x2135195643CCC32513Da3baDC6394FbaB8Fb9cfA`](https://etherscan.io/address/0x2135195643CCC32513Da3baDC6394FbaB8Fb9cfA#code)) was scanned with **[Nethermind AuditAgent](https://auditagent.nethermind.io/)** and Slither `0.11.5`:

* **Full PDF Report:** [`auditagent-scan-3-2026-12-06.pdf`](https://github.com/Rolaman/morfa-contracts/blob/main/audits/auditagent-scan-3-2026-12-06.pdf)
* **Findings Summary & Disposition:** [`audits/README.md`](https://github.com/Rolaman/morfa-contracts/blob/main/audits/README.md) (`0 High`, `1 Medium (Acknowledged)`, `0 Low`)
* **Bytecode Verification:** Verified on **Etherscan V2** and **Sourcify (`exact_match`)** (`solc v0.8.28`, `evmVersion: cancun`, `optimizer.runs: 1000`).

:::warning[Important Distinction: AI-Assisted Scan vs. Independent Human Audit]
**Nethermind AuditAgent** is an automated AI-powered code scanning tool. It was **not** manually reviewed by Nethermind's human security team, does not constitute a formal manual security audit by Nethermind, and no audit or scan eliminates smart contract risk.

As the protocol matures and Mode A adoption grows, Morfa contributors plan to consider additional independent human security audits for `MorfaRebalancer.sol`. Users who prefer to interact solely with tier-1 human-audited and formally verified contracts should choose **Mode B (`Morfa Vault / mfUSDC`)**.
:::

### Automated Testing & On-Chain Verification

In addition to automated security scanning and minimal immutable design, `MorfaRebalancer.sol` and the Mode B allocator flow are covered by a **Hardhat 3** test suite including:

* **Unit & fuzz invariant tests:** Verifying exact balance conservation (`USDC.balanceOf(this) == usdcBefore + res.fee`), donation safety, `≤ 2 wei` rounding enforcement, pre-supply `MIN_MARKET_SUPPLY` and `MAX_TARGET_UTILIZATION_WAD` checks, resetting 30-day `periodFeeCap` accounting, `setConfig` non-reset invariants, `enableWithSig` front-run and replay protection, fee-free and cooldown-exempt `WithdrawOnly` evacuations, `rebalanceBatch` per-item rollback isolation, and `48-hour` timelock state machines.
* **Ethereum Mainnet fork tests:** Replaying real Morpho Blue markets, real Morpho Vault V2 multicalls, real `AdaptiveCurveIRM` rate curves, and real Circle USDC transfers against pinned Ethereum Mainnet state.

Verified source code is published at [Rolaman/morfa-contracts (`contracts/MorfaRebalancer.sol`)](https://github.com/Rolaman/morfa-contracts/blob/main/contracts/MorfaRebalancer.sol).
