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.
Extends
Section titled “Extends”MorphoBase<MorphoMarketConfig>
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new MorphoMarketProtocolEvm(
account,config):MorphoMarketProtocolEvm
Defined in: protocol-lending-morpho-evm/src/market.ts:80
Parameters
Section titled “Parameters”account
Section titled “account”IWalletAccountReadOnly | IWalletAccount
config
Section titled “config”Returns
Section titled “Returns”MorphoMarketProtocolEvm
Overrides
Section titled “Overrides”MorphoBase<MorphoMarketConfig>.constructor
Properties
Section titled “Properties”_account
Section titled “_account”
protectedreadonly_account:IWalletAccountReadOnly|IWalletAccount
Defined in: core/dist/index-QWdcwE6y.d.ts:309
Inherited from
Section titled “Inherited from”MorphoBase._account
_config
Section titled “_config”
protectedreadonly_config:MorphoMarketConfig
Defined in: core/dist/index-QWdcwE6y.d.ts:310
Inherited from
Section titled “Inherited from”MorphoBase._config
protectedreadonlyapi:MorphoApi|null
Defined in: protocol-lending-morpho-evm/src/base.ts:51
Inherited from
Section titled “Inherited from”MorphoBase.api
readonlychain:MorphoChain
Defined in: protocol-lending-morpho-evm/src/base.ts:50
Inherited from
Section titled “Inherited from”MorphoBase.chain
chainId
Section titled “chainId”
readonlychainId:number
Defined in: protocol-lending-morpho-evm/src/base.ts:49
Inherited from
Section titled “Inherited from”MorphoBase.chainId
Accessors
Section titled “Accessors”activityVault
Section titled “activityVault”Get Signature
Section titled “Get Signature”get
protectedactivityVault():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.
Returns
Section titled “Returns”string | undefined
Inherited from
Section titled “Inherited from”MorphoBase.activityVault
client
Section titled “client”Get Signature
Section titled “Get Signature”get
protectedclient():object
Defined in: protocol-lending-morpho-evm/src/base.ts:99
Returns
Section titled “Returns”object
Inherited from
Section titled “Inherited from”MorphoBase.client
Get Signature
Section titled “Get Signature”get id():
`0x${string}`
Defined in: protocol-lending-morpho-evm/src/market.ts:99
The market id.
Returns
Section titled “Returns”`0x${string}`
Methods
Section titled “Methods”approvals()
Section titled “approvals()”
protectedapprovals(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.
Parameters
Section titled “Parameters”`0x${string}`
spender
Section titled “spender”`0x${string}`
amount
Section titled “amount”bigint
Returns
Section titled “Returns”Promise<Tx[]>
Inherited from
Section titled “Inherited from”MorphoBase.approvals
borrow()
Section titled “borrow()”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.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”Promise<LendingResult & object>
Overrides
Section titled “Overrides”MorphoBase.borrow
describeActivity()
Section titled “describeActivity()”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.
Parameters
Section titled “Parameters”ChainTx
DescribeActivityContext
Returns
Section titled “Returns”ActivityItem | null
Inherited from
Section titled “Inherited from”MorphoBase.describeActivity
encode()
Section titled “encode()”
protectedencode(abi,functionName,args):`0x${string}`
Defined in: protocol-lending-morpho-evm/src/base.ts:108
Parameters
Section titled “Parameters”readonly unknown[]
functionName
Section titled “functionName”string
readonly unknown[]
Returns
Section titled “Returns”`0x${string}`
Inherited from
Section titled “Inherited from”MorphoBase.encode
execute()
Section titled “execute()”
protectedexecute(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.
Parameters
Section titled “Parameters”approvals
Section titled “approvals”Tx[]
action
Section titled “action”string
Returns
Section titled “Returns”Promise<{ approveHashes: string[]; fee: bigint; hash: string; }>
Inherited from
Section titled “Inherited from”MorphoBase.execute
getMarket()
Section titled “getMarket()”getMarket():
Promise<MarketInfo>
Defined in: protocol-lending-morpho-evm/src/market.ts:126
The market with interest accrued to now, oracle price and rates.
Returns
Section titled “Returns”Promise<MarketInfo>
getPosition()
Section titled “getPosition()”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.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Promise<MarketPosition>
getStats()
Section titled “getStats()”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.
Returns
Section titled “Returns”Promise<ApiMarket | null>
protectedme():Promise<`0x${string}`>
Defined in: protocol-lending-morpho-evm/src/base.ts:112
Returns
Section titled “Returns”Promise<`0x${string}`>
Inherited from
Section titled “Inherited from”MorphoBase.me
previewSupplyShares()
Section titled “previewSupplyShares()”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).
Parameters
Section titled “Parameters”assets
Section titled “assets”bigint
Returns
Section titled “Returns”Promise<bigint>
prove()
Section titled “prove()”
protectedprove(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.
Parameters
Section titled “Parameters”action
Section titled “action”string
Returns
Section titled “Returns”Promise<void>
Inherited from
Section titled “Inherited from”MorphoBase.prove
quoteBorrow()
Section titled “quoteBorrow()”quoteBorrow(
o):Promise<LendingQuote&object>
Defined in: protocol-lending-morpho-evm/src/market.ts:325
Parameters
Section titled “Parameters”Returns
Section titled “Returns”Promise<LendingQuote & object>
Overrides
Section titled “Overrides”MorphoBase.quoteBorrow
quoteFee()
Section titled “quoteFee()”
protectedquoteFee(txs):Promise<bigint>
Defined in: protocol-lending-morpho-evm/src/base.ts:150
Parameters
Section titled “Parameters”Tx[]
Returns
Section titled “Returns”Promise<bigint>
Inherited from
Section titled “Inherited from”MorphoBase.quoteFee
quoteRepay()
Section titled “quoteRepay()”quoteRepay(
o):Promise<LendingQuote&object>
Defined in: protocol-lending-morpho-evm/src/market.ts:358
Parameters
Section titled “Parameters”Returns
Section titled “Returns”Promise<LendingQuote & object>
Overrides
Section titled “Overrides”MorphoBase.quoteRepay
quoteSupply()
Section titled “quoteSupply()”quoteSupply(
o):Promise<LendingQuote&object>
Defined in: protocol-lending-morpho-evm/src/market.ts:196
Parameters
Section titled “Parameters”Returns
Section titled “Returns”Promise<LendingQuote & object>
Overrides
Section titled “Overrides”MorphoBase.quoteSupply
quoteSupplyCollateral()
Section titled “quoteSupplyCollateral()”quoteSupplyCollateral(
o):Promise<LendingQuote&object>
Defined in: protocol-lending-morpho-evm/src/market.ts:254
Parameters
Section titled “Parameters”amount
Section titled “amount”number | bigint
onBehalfOf?
Section titled “onBehalfOf?”string
Returns
Section titled “Returns”Promise<LendingQuote & object>
quoteWithdraw()
Section titled “quoteWithdraw()”quoteWithdraw(
o):Promise<LendingQuote&object>
Defined in: protocol-lending-morpho-evm/src/market.ts:228
Parameters
Section titled “Parameters”Returns
Section titled “Returns”Promise<LendingQuote & object>
Overrides
Section titled “Overrides”MorphoBase.quoteWithdraw
quoteWithdrawCollateral()
Section titled “quoteWithdrawCollateral()”quoteWithdrawCollateral(
o):Promise<LendingQuote&object>
Defined in: protocol-lending-morpho-evm/src/market.ts:286
Parameters
Section titled “Parameters”amount
Section titled “amount”string
Returns
Section titled “Returns”Promise<LendingQuote & object>
read()
Section titled “read()”
protectedread<T>(address,abi,functionName,args?):Promise<T>
Defined in: protocol-lending-morpho-evm/src/base.ts:104
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”address
Section titled “address”`0x${string}`
readonly unknown[]
functionName
Section titled “functionName”string
readonly unknown[] = []
Returns
Section titled “Returns”Promise<T>
Inherited from
Section titled “Inherited from”MorphoBase.read
repay()
Section titled “repay()”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.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”Promise<LendingResult & object>
Overrides
Section titled “Overrides”MorphoBase.repay
requireSigningAccount()
Section titled “requireSigningAccount()”
protectedrequireSigningAccount(methodName):IWalletAccount
Defined in: core/dist/index-QWdcwE6y.d.ts:322
The account, narrowed to a signing one, or a ReadOnlyAccountError naming the caller.
Parameters
Section titled “Parameters”methodName
Section titled “methodName”string
Returns
Section titled “Returns”IWalletAccount
Inherited from
Section titled “Inherited from”MorphoBase.requireSigningAccount
send()
Section titled “send()”
protectedsend(tx):Promise<{fee:bigint;hash:string; }>
Defined in: protocol-lending-morpho-evm/src/base.ts:120
Parameters
Section titled “Parameters”Returns
Section titled “Returns”Promise<{ fee: bigint; hash: string; }>
Inherited from
Section titled “Inherited from”MorphoBase.send
setAuthorization()
Section titled “setAuthorization()”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).
Parameters
Section titled “Parameters”__namedParameters
Section titled “__namedParameters”enabled
Section titled “enabled”boolean
manager
Section titled “manager”string
Returns
Section titled “Returns”Promise<LendingResult>
supply()
Section titled “supply()”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).
Parameters
Section titled “Parameters”Returns
Section titled “Returns”Promise<LendingResult & object>
Overrides
Section titled “Overrides”MorphoBase.supply
supplyCollateral()
Section titled “supplyCollateral()”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.
Parameters
Section titled “Parameters”amount
Section titled “amount”number | bigint
onBehalfOf?
Section titled “onBehalfOf?”string
Returns
Section titled “Returns”Promise<LendingResult & object>
tokenMeta()
Section titled “tokenMeta()”
protectedtokenMeta(token):Promise<{decimals:number;symbol:string; }>
Defined in: protocol-lending-morpho-evm/src/base.ts:185
Parameters
Section titled “Parameters”`0x${string}`
Returns
Section titled “Returns”Promise<{ decimals: number; symbol: string; }>
Inherited from
Section titled “Inherited from”MorphoBase.tokenMeta
wait()
Section titled “wait()”
protectedwait(hash):Promise<void>
Defined in: protocol-lending-morpho-evm/src/base.ts:128
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Promise<void>
Inherited from
Section titled “Inherited from”MorphoBase.wait
withdraw()
Section titled “withdraw()”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).
Parameters
Section titled “Parameters”Returns
Section titled “Returns”Promise<LendingResult & object>
Overrides
Section titled “Overrides”MorphoBase.withdraw
withdrawCollateral()
Section titled “withdrawCollateral()”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.
Parameters
Section titled “Parameters”amount
Section titled “amount”string
Returns
Section titled “Returns”Promise<LendingResult & object>
writable()
Section titled “writable()”
protectedwritable(method):IWalletAccount
Defined in: protocol-lending-morpho-evm/src/base.ts:116
Parameters
Section titled “Parameters”method
Section titled “method”string
Returns
Section titled “Returns”IWalletAccount
Inherited from
Section titled “Inherited from”MorphoBase.writable