Disclaimer
This tutorial is for informational purposes only. It explains how to interact directly with Morpho smart contracts through a block explorer.
Interacting with smart contracts through a block explorer can be risky.
You are responsible for checking every contract address, function, parameter, network, and transaction before signing. Only proceed if you understand Morpho contracts, ERC-4626 vault mechanics, and how to use block explorers safely.
Morpho Association is not responsible for any loss, failed transaction, incorrect input, unexpected contract behavior, loss of funds, or other consequence resulting from direct contract interactions.
By accessing or using the tutorial or the Morpho protocols, you acknowledge and agree to the terms of this disclaimer.
Explorer basics
For any contract interaction, you need to connect your wallet to the block explorer on the correct network.
Always check that:
- you are on the correct chain
- you are using the correct contract address
- your connected wallet is the wallet that owns the position
- every input is filled in the expected format
Asset amounts in explorers
Block explorers expect raw token units, not human-readable amounts. Most ERC-20 tokens use decimals. To enter an amount, multiply the human amount by 10^decimals.
Example: WETH has 18 decimals, so:
1 WETH = 1 × 10^18 = 1000000000000000000
0.01 WETH = 0.01 × 10^18 = 10000000000000000
You should always check the token’s decimals() value before entering an amount. If you enter 1 for an 18-decimal token, the contract reads it as 0.000000000000000001 token, not 1 token.
Withdraw from a Morpho Vault V2
Withdrawals may fail due to vault conditions or configuration, including insufficient liquidity, liquidity adapter limits, or active gates. Before using the explorer method, check that the vault currently allows your wallet to withdraw the intended amount and that your address is allowed to send shares and receive assets.
You need to interact with the vault contract on the dedicated explorer of the specified chain.
Before you start
You need:
- the block explorer for the correct network
- the wallet that owns the vault position
- the underlying asset decimals, for example WETH has 18 decimals
- the vault contract address
If you don't have the vault contract address, you can use the vault page on the Morpho app, there is a button sending you to its explorer page:
Full withdrawal - redeem
Step 1 - read your vault-share balance
On the vault contract, go to Read Contract and search for the balanceOf function:
Input:
account = your wallet address
Click on Query.
Output (shares) = your vault-share balance
Your vault-share balance represents your entire position in the vault.
Copy this output. You will use it in the next steps.
Step 2 - execute the full withdrawal
On the same vault contract, go to Write Contract and search for the redeem function:
Inputs:
shares = the balanceOf output retrieved at Step 1
receiver = your wallet address
onBehalf = your wallet address
Click Write.
Your wallet should trigger a recap of the transaction, confirm it if you want to continue. If successful, your vault-share balance (in balanceOf) becomes 0, and your wallet receives the underlying asset.
Withdraw a specific amount - withdraw
Use this when you want to withdraw a specific amount of the underlying asset.
withdraw takes an asset amount, burns the required vault shares, and sends exactly that asset amount to the receiver.
Before withdrawing a specific amount, make sure that:
- the amount you want to withdraw is lower than or equal to your current vault position
- the vault has enough available liquidity to process the withdrawal
- no vault configuration, such as gates or other restrictions, prevents your wallet from withdrawing
Step 1 - choose the amount to withdraw
Example: withdrawing 0.0002 WETH
assets = 200000000000000
See asset amount details here.
Step 2 - withdraw the amount
On the vault contract, go to Write Contract and search for the withdraw function:
Inputs:
assets = 200000000000000 (adjust to your need)
receiver = your wallet address
onBehalf = your wallet address
Click Write.
Your wallet should trigger a recap of the transaction, confirm it if you want to continue.
Interact with Variable Rate markets - Basics
To interact at Variable Rate Market level, you will need to interact with the Morpho Blue contract on the chain you have the position on.
You can find Morpho Blue deployment and link to explorers in the documentation here.
Always make sure you interact with the proper contracts.
Market identification
A Variable Rate Market on Morpho Blue can be identified by two pieces of information:
- A Market Id
- marketParams, the five parameters of a market: collateral asset, loan asset, market oracle, IRM and LLTV
If you don't have the market Id, you can use the market page on the Morpho app, there is a button to copy it:
To retrieve the marketParams, on the Morpho Blue contract, go to Read Contract and search for the idToMarketParams function.
Here the input is the Market Id and it will return the set of market params:
- loanToken (address)
- collateralToken (address)
- oracle (address)
- irm (address)
- lltv (uint256)
Position amount - shares and assets
A supply or borrow position on a Morpho Variable Rate Market can be represented by shares or assets.
- Use shares when you want to close the full position.
- Use assets when you want to withdraw or repay a specific amount.
- Collateral positions are represented only by assets.
When using shares, set assets = 0. When using assets, set shares = 0.
Common interaction logic
For loan asset withdrawals (withdraw), collateral asset withdrawals (withdrawCollateral) and loan asset repayment (repay), inputs have the same main structure:
- marketParams
- assets
- shares (for withdraw and repay only - no shares on collateral positions)
- onBehalf (The address of the owner of the position)
- receiver (The address that will actually receive the assets - for withdraw and withdrawCollateral)
- data (for repay only - input "0x" if present)
Nomenclature
- withdraw = withdraw supplied loan asset
- repay = repay borrowed loan asset
- withdrawCollateral = withdraw collateral asset
Withdraw loan asset from a Variable Rate Market - withdraw
Before withdrawing make sure that:
- the amount you want to withdraw is lower than or equal to your current supplied position in the market
- the market has enough available liquidity to process the withdrawal
Here are the two steps to fully withdraw a supply position from a market:
Step 1 - Read your supply shares balance
The supplyShares value represents your supplied loan asset position in the market.
On the Morpho Blue contract, in the Read Contract page, search for the position function:
Inputs:
bytes32 = the marketId
address = your wallet address
The function will return the state of your position in the market, including:
supplyShares = the state of your loan asset supply position - in shares - will be used for the withdrawal, copy it.
borrowShares = state of your loan position - if any - in shares
collateral = state of your collateral position - if any - in assets
Step 2 - Fully withdraw
To use the withdraw function, the inputs are different. First, you will need to identify the market on Morpho Blue you want to interact with on the explorer. It won't be via the marketId used previously, but with the marketParams instead.
Then, on the Morpho Blue contract, go to Write Contract and search for the withdraw function:
Inputs:
marketParams = retrieved via idToMarketParams (see how here)
assets / shares = shares for full withdrawal using Step 1 supplyShares balance - assets for specific amount withdrawals (if use shares, assets = 0 - if use assets, shares = 0)
onBehalf = The address of the owner of the supply position.
receiver = The address that will receive the withdrawn assets.
Click Write.
Your wallet should trigger a recap of the transaction, confirm it if you want to continue.
For partial withdrawals, use assets instead of shares. Make sure the assets amount has the proper format (see how here).
Repay loan in a Variable Rate Market - repay
Before repaying, make sure that:
- the amount you want to repay is lower than or equal to your current borrowed position in the market
- your wallet has enough loan asset balance to cover the repayment
- your wallet has approved the Morpho contract to spend the loan asset, if required (see Step 2)
- no account-level condition, authorization issue, or integration-specific restriction prevents your wallet from repaying the borrowed loan asset
Step 1 - Read your borrow shares balance
The borrowShares value represents your borrowed loan asset position in the market.
On the Morpho Blue contract, in the Read Contract page, search for the position function:
Inputs:
bytes32 = the marketId
address = your wallet address
The function will return the state of your position in the market, including:
supplyShares = the state of your loan asset supply position - if any - in shares
borrowShares = state of your loan position - in shares - will be used for the repayment, copy it.
collateral = state of your collateral position - in assets
Step 2 - token approval
In order to repay your position, you will have to send the loan asset to the Morpho contract.
Before doing so, you will need to allow the Morpho Blue contract, on-chain, to take the assets from your wallet - this is a prerequisite to be able to repay.
This approval does not happen at Morpho contract level but at token contract level.
Input the Morpho Blue contract address on the chain and the amount you want to approve.
See asset amount format details here (approve an amount higher than what you want to repay to account for interest accrual).
Example below for the USDC asset: https://basescan.org/address/0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913#writeProxyContract#F1
Step 3 - Fully repay
Once the approval is done, on the Morpho Blue contract, go to Write Contract and search for the repay function:
Inputs:
marketParams = retrieved via idToMarketParams (see how here)
assets / shares = shares for full repayment using Step 1 borrowShares balance - assets for specific amount to repay (if use shares, assets = 0 - if use assets, shares = 0)
onBehalf = The address of the owner of the borrow position.
data = input "0x"
Click Write.
Your wallet should trigger a recap of the transaction, confirm it if you want to continue.
For partial repayment, use assets instead of shares. Make sure the assets amount has the proper format (see how here).
Withdraw collateral from a Variable Rate Market - withdrawCollateral
Before withdrawing collateral, make sure that:
- the amount you want to withdraw is lower than or equal to your current collateral position in the market
- your remaining collateral is enough to keep your borrowed position healthy after the withdrawal
- the withdrawal does not put your account at risk of liquidation
- no account-level condition, authorization issue, or integration-specific restriction prevents your wallet from withdrawing collateral
Step 1 - Read your collateral
assetsbalance
The collateral assets (collateral) represent your collateral position in the market.
On the Morpho Blue contract, in the Read Contract page, search for the position function:
Inputs:
bytes32 = the marketId
address = your wallet address
The function will return the state of your position in the market, including:
supplyShares = the state of your loan asset supply position - if any - in shares
borrowShares = state of your loan position - if any - in shares
collateral = state of your collateral position - in assets- will be used for the withdrawal, copy it.
Step 2 - Withdraw your collateral
On the Morpho Blue contract, go to Write Contract and search for the withdrawCollateral function:
Inputs:
marketParams = retrieved via idToMarketParams (see how here)
assets = the collateral amount to withdraw, using the asset amount format explained here. Your collateral position state is retrievable via the position function as shown here.
onBehalf = the address of the owner of the collateral position.
receiver = the address that will receive the collateral assets.
Click Write.
Your wallet should trigger a recap of the transaction, confirm it if you want to continue.
If any issue or additional question, get in touch opening the chatbox at the bottom right of the help page 👉






















