Skip to main content

Withdrawing collateral from a Morpho borrow position

Check whether you have any remaining collateral in a Morpho Blue market and withdraw it.

If you opened a borrow position on a Morpho Blue market on Corn (WBTCN/LBTC or USD₮0/WBTCN), check whether you have any remaining collateral and withdraw it before the chain shuts down.

You can also see your positions on the Earn page of the Corn Chain App.

Step 1 — Check your position state

Go to the Morpho Blue contract on Cornscan: 0xc2B1E031540e3F3271C5F3819F0cC7479a8DdD90.

  1. Click ContractRead Contract.

  2. Find the position(bytes32 id, address user) function.

  3. Enter the market id and your wallet address.

  4. Click Query. The result is (supplyShares, borrowShares, collateral).

Look at the values:

  • collateral — the amount of collateral still in the position, in raw units (e.g. 8 decimals for LBTC, 18 decimals for wBTCN).

  • borrowShares — outstanding debt. Must be 0 for the withdraw to succeed.

Market IDs:

  • WBTCN/LBTC (94.5%)0x2547ba491a7ff9e8cfcaa3e1c0da739f4fdc1be9fe4a37bfcdf570002153a0de

  • USD₮0/WBTCN (86%)0x9039bf8b5c3cd6f2d3f937e8a2e59ef6af0109a0d0f3499e7dbf75be0aef75ec

If collateral is 0, there's nothing to withdraw — you're done.

If collateral is greater than 0 and borrowShares is 0, continue to step 2.

If borrowShares is non-zero, you still have outstanding debt and withdrawCollateral won't succeed until the debt is cleared. Ping us in Discord and we'll help figure out the right next step.

Step 2 — Call withdrawCollateral

  1. Click Connect Wallet.

  2. Find the withdrawCollateral function.

  3. Fill in:
    - marketParams — the tuple (loanToken, collateralToken, oracle, irm, lltv) for your market. Ping us in Discord if you need the exact tuple — we'll provide it.
    - assets — the collateral amount you read in Step 1.
    - onBehalf — your wallet address.
    - receiver — your wallet address.

  4. Click Write and confirm.

The collateral token (LBTC or wBTCN) appears in your wallet.

Step 3 — Bridge or unwrap

Help

withdrawCollateral reverting with "INSUFFICIENT_COLLATERAL" usually means there's still outstanding debt. Confirm borrowShares == 0 first via the position read. For any other issue, ping us in the Corn Discord with the failing transaction hash.

Did this answer your question?