The gNTB / cNGN market (Base Sepolia)
Most Morpho calls take the parameters as a struct, not the id:
Morpho.idToMarketParams(0x3682…76a3).
Borrowing
Approve Morpho for the token first (approve(0xBBBB…EFFCb, amount) on gNTB to post
collateral, on cNGN to repay). Amounts are in token base units: on Base Sepolia gNTB has
18 decimals and cNGN 6. Read decimals() on each token rather than assuming.
1
Post collateral
onBehalf is the wallet that will own the position, normally your own.2
Borrow cNGN
assets and 0 shares. Reverts if the position would exceed the
77% LLTV, or if the market has less idle cNGN than you ask for.3
Repay
4
Withdraw collateral
Lending
totalSupplyAssets − totalBorrowAssets.
Reading a position
- Debt (assets) =
borrowShares × totalBorrowAssets ÷ totalBorrowShares, rounded up. - Collateral value in cNGN =
collateral × price ÷ 1e36. - Health =
collateral value × 0.77 ÷ debt.
market() totals are as of lastUpdate; to include interest since then, use Morpho’s
MorphoBalancesLib (or accrue with the IRM’s borrowRateView).
The oracle
RWAPriceOracle reverts with NoPrice instead of returning 0, including when the
asset’s payment token has changed. While it reverts, Morpho cannot price the collateral,
so borrows, withdrawals and liquidations revert too; repaying and supplying still work.
Liquidation
When health ≤ 1.0, anyone may call:Events to index
From Morpho Blue:SupplyCollateral, Borrow, Repay, WithdrawCollateral, Supply,
Withdraw, Liquidate, each keyed by market id. See
Morpho’s contract reference for the full signatures.