Skip to content
docs

MorphoMarketProtocolEvm

Defined in: protocol-lending-morpho-evm/src/market.ts:75

One Morpho Blue market as a LendingProtocol: supply / withdraw lend the loan token to the market (shares appreciate with borrowers’ interest), borrow / repay take and return the loan token against the collateral the account posts with supplyCollateral / withdrawCollateral.

The market is resolved on-chain from its id or params (idToMarketParams, market().lastUpdate != 0), state is read with interest accrued to now the way accrueInterest would, and every write is checked against the market’s liquidity and the position’s health (oracle price × LLTV) before eth_call proves it. Morpho’s revert strings are translated.

new MorphoMarketProtocolEvm(account, config): MorphoMarketProtocolEvm

Defined in: protocol-lending-morpho-evm/src/market.ts:80

IWalletAccountReadOnly | IWalletAccount

MorphoMarketConfig

MorphoMarketProtocolEvm

MorphoBase<MorphoMarketConfig>.constructor

protected readonly _account: IWalletAccountReadOnly | IWalletAccount

Defined in: core/dist/index-QWdcwE6y.d.ts:309

MorphoBase._account


protected readonly _config: MorphoMarketConfig

Defined in: core/dist/index-QWdcwE6y.d.ts:310

MorphoBase._config


protected readonly api: MorphoApi | null

Defined in: protocol-lending-morpho-evm/src/base.ts:51

MorphoBase.api


readonly chain: MorphoChain

Defined in: protocol-lending-morpho-evm/src/base.ts:50

MorphoBase.chain


readonly chainId: number

Defined in: protocol-lending-morpho-evm/src/base.ts:49

MorphoBase.chainId

get protected activityVault(): string | undefined

Defined in: protocol-lending-morpho-evm/src/base.ts:77

A vault this instance targets (the vault protocol sets it); accepted by address in describeActivity.

string | undefined

MorphoBase.activityVault


get protected client(): object

Defined in: protocol-lending-morpho-evm/src/base.ts:99

object

MorphoBase.client


get id(): `0x${string}`

Defined in: protocol-lending-morpho-evm/src/market.ts:99

The market id.

`0x${string}`

protected approvals(token, spender, amount): Promise<Tx[]>

Defined in: protocol-lending-morpho-evm/src/base.ts:160

Exact-amount ERC-20 approvals, with the approve(0) reset Ethereum’s USDT demands before a raise.

`0x${string}`

`0x${string}`

bigint

Promise<Tx[]>

MorphoBase.approvals


borrow(o): Promise<LendingResult & object>

Defined in: protocol-lending-morpho-evm/src/market.ts:318

Borrows amount of the loan token against the account’s collateral (or onBehalfOf’s, with authorization) to to.

MorphoMarketBorrowOptions

Promise<LendingResult & object>

MorphoBase.borrow


describeActivity(tx, ctx): ActivityItem | null

Defined in: protocol-lending-morpho-evm/src/base.ts:84

Recognize Morpho transactions offline: Blue by the singleton’s address (preset for the transaction’s chain, or this instance’s), vaults by ERC-4626 selector + the called contract’s shares minted to / burned from the wallet. See activity.ts.

ChainTx

DescribeActivityContext

ActivityItem | null

MorphoBase.describeActivity


protected encode(abi, functionName, args): `0x${string}`

Defined in: protocol-lending-morpho-evm/src/base.ts:108

readonly unknown[]

string

readonly unknown[]

`0x${string}`

MorphoBase.encode


protected execute(plan, action): Promise<{ approveHashes: string[]; fee: bigint; hash: string; }>

Defined in: protocol-lending-morpho-evm/src/base.ts:171

Approvals (each awaited to a receipt), then the main transaction, proven first.

Tx[]

Tx

string

Promise<{ approveHashes: string[]; fee: bigint; hash: string; }>

MorphoBase.execute


getMarket(): Promise<MarketInfo>

Defined in: protocol-lending-morpho-evm/src/market.ts:126

The market with interest accrued to now, oracle price and rates.

Promise<MarketInfo>


getPosition(user?): Promise<MarketPosition>

Defined in: protocol-lending-morpho-evm/src/market.ts:145

The account’s (or user’s) position with health computed at the current oracle price.

string

Promise<MarketPosition>


getStats(): Promise<ApiMarket | null>

Defined in: protocol-lending-morpho-evm/src/market.ts:165

The market’s API record (APY, listed, TVL) — decoration; null without API.

Promise<ApiMarket | null>


protected me(): Promise<`0x${string}`>

Defined in: protocol-lending-morpho-evm/src/base.ts:112

Promise<`0x${string}`>

MorphoBase.me


previewSupplyShares(assets): Promise<bigint>

Defined in: protocol-lending-morpho-evm/src/market.ts:373

Shares the market would mint for assets supplied now (for previews).

bigint

Promise<bigint>


protected prove(tx, action): Promise<void>

Defined in: protocol-lending-morpho-evm/src/base.ts:142

eth_call from the account; a Morpho / vault revert becomes a readable MorphoError.

Tx

string

Promise<void>

MorphoBase.prove


quoteBorrow(o): Promise<LendingQuote & object>

Defined in: protocol-lending-morpho-evm/src/market.ts:325

MorphoMarketBorrowOptions

Promise<LendingQuote & object>

MorphoBase.quoteBorrow


protected quoteFee(txs): Promise<bigint>

Defined in: protocol-lending-morpho-evm/src/base.ts:150

Tx[]

Promise<bigint>

MorphoBase.quoteFee


quoteRepay(o): Promise<LendingQuote & object>

Defined in: protocol-lending-morpho-evm/src/market.ts:358

MorphoMarketRepayOptions

Promise<LendingQuote & object>

MorphoBase.quoteRepay


quoteSupply(o): Promise<LendingQuote & object>

Defined in: protocol-lending-morpho-evm/src/market.ts:196

MorphoMarketSupplyOptions

Promise<LendingQuote & object>

MorphoBase.quoteSupply


quoteSupplyCollateral(o): Promise<LendingQuote & object>

Defined in: protocol-lending-morpho-evm/src/market.ts:254

number | bigint

string

Promise<LendingQuote & object>


quoteWithdraw(o): Promise<LendingQuote & object>

Defined in: protocol-lending-morpho-evm/src/market.ts:228

MorphoMarketWithdrawOptions

Promise<LendingQuote & object>

MorphoBase.quoteWithdraw


quoteWithdrawCollateral(o): Promise<LendingQuote & object>

Defined in: protocol-lending-morpho-evm/src/market.ts:286

AmountOption

string

Promise<LendingQuote & object>


protected read<T>(address, abi, functionName, args?): Promise<T>

Defined in: protocol-lending-morpho-evm/src/base.ts:104

T

`0x${string}`

readonly unknown[]

string

readonly unknown[] = []

Promise<T>

MorphoBase.read


repay(o): Promise<LendingResult & object>

Defined in: protocol-lending-morpho-evm/src/market.ts:352

Repays amount of the loan token (or ‘max’ → all borrow shares) for the account or onBehalfOf.

MorphoMarketRepayOptions

Promise<LendingResult & object>

MorphoBase.repay


protected requireSigningAccount(methodName): IWalletAccount

Defined in: core/dist/index-QWdcwE6y.d.ts:322

The account, narrowed to a signing one, or a ReadOnlyAccountError naming the caller.

string

IWalletAccount

MorphoBase.requireSigningAccount


protected send(tx): Promise<{ fee: bigint; hash: string; }>

Defined in: protocol-lending-morpho-evm/src/base.ts:120

Tx

Promise<{ fee: bigint; hash: string; }>

MorphoBase.send


setAuthorization(__namedParameters): Promise<LendingResult>

Defined in: protocol-lending-morpho-evm/src/market.ts:365

Lets (or stops letting) manager act on the account’s positions on this chain’s Morpho (all markets).

boolean

string

Promise<LendingResult>


supply(o): Promise<LendingResult & object>

Defined in: protocol-lending-morpho-evm/src/market.ts:191

Lends amount of the loan token to the market; supply shares go to onBehalfOf (default: the account).

MorphoMarketSupplyOptions

Promise<LendingResult & object>

MorphoBase.supply


supplyCollateral(o): Promise<LendingResult & object>

Defined in: protocol-lending-morpho-evm/src/market.ts:249

Posts collateral for onBehalfOf (default: the account). Collateral earns nothing; it backs borrows.

number | bigint

string

Promise<LendingResult & object>


protected tokenMeta(token): Promise<{ decimals: number; symbol: string; }>

Defined in: protocol-lending-morpho-evm/src/base.ts:185

`0x${string}`

Promise<{ decimals: number; symbol: string; }>

MorphoBase.tokenMeta


protected wait(hash): Promise<void>

Defined in: protocol-lending-morpho-evm/src/base.ts:128

string

Promise<void>

MorphoBase.wait


withdraw(o): Promise<LendingResult & object>

Defined in: protocol-lending-morpho-evm/src/market.ts:221

Withdraws supplied loan tokens (amount or ‘max’ → by shares) to to (default: the account).

MorphoMarketWithdrawOptions

Promise<LendingResult & object>

MorphoBase.withdraw


withdrawCollateral(o): Promise<LendingResult & object>

Defined in: protocol-lending-morpho-evm/src/market.ts:279

Takes collateral back (amount or ‘max’); refused when the remaining collateral would not cover the debt.

AmountOption

string

Promise<LendingResult & object>


protected writable(method): IWalletAccount

Defined in: protocol-lending-morpho-evm/src/base.ts:116

string

IWalletAccount

MorphoBase.writable