Skip to main content
Blend’s on-chain protocol consists of 9 contract systems handling Safe deployment, vault operations, cross-chain bridging, and security enforcement.

Contract map

Contract systems

Deploys and sets up Gnosis Safe proxies with Blend’s module and guard architecture.Key functions:
deploySafe is restricted to the module’s executor (StrategyManager(module).executor()). It validates non-empty owners, valid threshold, and that module/guard are set.enableModuleAndSetGuardFromFactory reads module and guard addresses from factory storage at runtime. This is what enables cross-chain address determinism. Module and guard can differ per chain while Safe addresses stay identical.Setup installs three components:
  1. RolesReceiver as module (strategy execution)
  2. RolesGuard as transaction guard (pause + access control)
  3. Safe4337Module as module and fallback handler (account abstraction)
Core orchestration layer. Manages vault configs, executes rebalances, and enforces rate limiting.Key structs:
Key functions:
Security invariants:
  • Rate limited per (safe, vault) pair via keccak256(abi.encodePacked(safe, vault))
  • MIN_SECONDS_BETWEEN_OPERATIONS enforced (1-300 seconds)
  • Timestamp set before execution; full transaction reverts on failure
  • Config validation rejects duplicate marketIds and duplicate action controllers
Two contracts that validate transactions and hold timelocked configuration.RolesGuard - Transaction guard on every Safe:
When paused: checkTransaction allows Safe owners to execute directly. checkModuleTransaction blocks ALL module transactions with no owner bypass.RolesReceiver - Holds vault configs and the executor. Extends StrategyManager. Two timelocks on the same chain administer it directly, with no cross-chain messaging:
  • Only the operational timelock can call updateVaultConfig. Each config change waits 2 days.
  • Only the security timelock can call setExecutor. It owns the contract, and its changes wait 7 days.
Orchestrates Morpho vault rebalancing.
Execution flow:
  1. Wrap native ETH if vault token is WETH
  2. Deposit existing vault tokens into vault
  3. Process all decrease operations (withdraw collateral)
  4. Process all increase operations (supply collateral)
Supporting libraries:
  • MorphoSeedingLib - Handles collateral supply and withdrawal. No borrowing involved.
  • MorphoVaultLib - Utility functions for deposit/withdraw with slippage checks and price data decoding.
Security invariants:
  • Slippage protection via assets/shares ratio checks against assetPerShare
  • Processes decreases before increases (frees capital first)
UserWithdrawController - Full 9-step withdrawal lifecycle:
The 9 steps:
  1. Validate amount, module, vault, single-owner requirement
  2. Liquidity reset via VaultController.executeRebalance
  3. Snapshot balance, resolve max withdrawal
  4. Force deallocate from adapters (zero-penalty only)
  5. Vault withdrawal with slippage protection
  6. Determine actual withdrawn amount
  7. Deduct withdrawal fee (max 5%)
  8. Transfer to owner OR bridge cross-chain
  9. Redeposit remaining assets into vault
Bridge patching uses packed bridgeOffsets (recipientOffset, inputAmountOffset, outputAmountOffset, destDecimals) to inject values into pre-built bridge calldata.
These adapters handle token swaps within Bundler3 multicalls.SwapAdapter - Base contract:
Three layers of slippage protection:
  1. Governance max (maxSlippageBps) - hard ceiling
  2. Per-swap (slippageBps <= maxSlippageBps) - caller-specified
  3. Oracle-verified minimum output via PriceLib
checkSwapInvariants ensures the adapter holds zero tokens before and after every swap.BalanceReplacementAdapter - Reads token balances and injects them into calldata at specified offsets using bitwise OR. Handles temporary approvals and balance draining.
Two bridge adapters and a batching controller for cross-chain transfers.AcrossXChainAdapter - Bridges via Across V3 SpokePool:
Supports any token. Validates slippage via PriceLib.normalize and applySlippage. Validates all address and amount parameters match. Refunds dust to sender.CCTPXChainAdapter - Bridges USDC via Circle CCTP V2:USDC-only. Queries burnLimitsPerMessage from the minter. If the amount exceeds the limit, it splits into multiple depositForBurn calls automatically.Uses maxFee=0, minFinalityThreshold=2000 (Standard finality).XChainVaultAction - Orchestrates batched cross-chain vault actions:
  • Requests MUST be sorted ascending by destinationChainId (enables O(N) duplicate detection)
  • Single vault withdrawal, then executes each bridge request
  • Verifies zero adapter balance after each transfer
  • Sweeps remaining balance back to vault
Layered controller system for vault operations.DelegateController - Base security. _onlyDelegateCall modifier compares address(this) against immutable SELF. Ensures code only runs via delegatecall from a Safe.VaultController - Extends DelegateController. Provides _validateRebalanceData modifier that checks rebalanceData length matches markets, all marketIds match, and vault is configured.VaultActionController - Extends DelegateController. Provides the executeAction(vault, strategyData, extraData) entry point that delegates to abstract _execute.VaultToVaultAction - Moves funds between vaults with optional swap. Validates both source and destination vaults are registered. Uses SwapAdapter with oracle slippage protection when asset types differ.
Utility contracts used across the protocol.PriceLib - Oracle and decimal utilities:

Architecture overview

See how these contracts fit into the full system.

Security deep dive

Understand the 3 security layers protecting every transaction.

Deployments

Find deployed contract addresses on each chain.

Audits

Review independent security audit reports.
Last modified on November 25, 2026