Skip to main content

Overview

Monolith is a permissionless stablecoin factory. There is no off-chain API, SDK, or indexer — all interactions go through on-chain contracts. This guide shows the core flows. Before reading, make sure you have the contract addresses for your chain.

Core contracts

Deploying a new instance

Factory.deploy(DeployParams) creates a Lender, Coin, and Vault in a single transaction and returns their addresses.
See Stablecoin Factory for parameter guidance.

Borrowing and managing a position

Lender.adjust is the single entry point for all position changes: deposit/withdraw collateral, borrow/repay debt, switch between paid and free (redeemable) debt modes.
Example — deposit 1 WETH and borrow 1,000 Coin in paid-debt mode:
Example — repay all debt and withdraw all collateral:
Delegation (lender.delegate(address, bool)) lets another address manage the position on the owner’s behalf.

Staking the Coin

Vault is a standard ERC‑4626. Yield comes from interest paid by borrowers in paid-debt mode.
Note: the first depositor burns 1e16 shares (MIN_SHARES) to prevent the ERC‑4626 inflation attack.

Redemption (arbitrage)

Anyone can redeem Coin for a redeemable borrower’s collateral at oracle price minus redeemFeeBps.
Preview the outcome off-chain via Lens (simulates without mutating state):
See Redemptions for the mechanism.

PSM (if enabled on the instance)

If psmAsset was configured at deployment, anyone can convert between Coin and the PSM asset at 1:1 (decimals-adjusted).

Querying state

Lender exposes direct getters; Lens provides a version that simulates accrual before reading.

Liquidating a position

Up to 25% of a position’s debt (or the full position if smaller) can be liquidated per call, with a minimum chunk of 10_000e18. Incentive scales from 0% at the collateral factor up to 10% at collateralFactor + 500 bps. See Liquidations.

Events to index

Factory:
  • Deployed(address indexed lender, address indexed coin, address indexed vault)
Per Lender (subset most integrators care about):
  • PositionAdjusted(address indexed account, int collateralDelta, int debtDelta)
  • RedemptionStatusUpdated(address indexed account, bool isRedeemable)
  • Liquidated(address indexed borrower, address indexed liquidator, uint repayAmount, uint collateralOut)
  • Redeemed(address indexed account, address indexed borrower, uint amountIn, uint amountOut)
  • Sold(address indexed account, uint coinIn, uint assetOut)
  • Bought(address indexed account, uint assetIn, uint coinOut)
  • WrittenOff(address indexed borrower, address indexed to, uint debt, uint collateral)
See the Lender reference for the full list.

JavaScript example (ethers v6)

Source

ABIs and Solidity sources: github.com/MonolithMarket/Monolith.