SDK
Leverage

Leverage

Usage

import { Matrix } from '@morphous/trinity'
 
const data = await Matrix.leverage(
  morphoMarketAddress,
  txDeadline,
  fromWallet,
  collateralMarketAddress,
  debtMarketAddress,
  collateralToken,
  debtToken,
  address,
  smartWallet,
  collateralValue,
  debtValue,
  aggregator,
  slippage
)

Configuration

morphoMarketAddress

string - The Morpho Proxy market address, either Morpho Compound or Morpho Aave v2. The corresponding address can be found in Morpho's developer documentation (opens in a new tab).

txDeadline

number - The period of time before the transaction is reverted (in seconds).

fromWallet

boolean - true if the funds should be deposited from the user's wallet, false if the funds should be deposited from the user's DSProxy.

collateralMarketAddress

string - Compound or Aave v2 collateral market address. It can be found in Compound's documentation (opens in a new tab) or Aave v2 documentation (opens in a new tab).

debtMarketAddress

string - Compound or Aave v2 debt market address. It can be found in Compound's documentation (opens in a new tab) or Aave v2 documentation (opens in a new tab).

collateralToken

Token - Object with collateral token data

{
  address: string
  name: string
  symbol: string
  decimals: number
  extensions?: any
}

debtToken

Token - Object with debt token data

{
  address: string
  name: string
  symbol: string
  decimals: number
  extensions?: any
}

userAddress

string - User's wallet address.

smartWalletAddress

string - User's DSProxy address.

collateralValue

BigNumber - Value to deposit as collateral.

debtValue

BigNumber - Value to borrow as debt.

aggregator

string - Value to borrow as debt.

slippage

number - min: 0, max: 10000. For example, 50 for 0.50% slippage.

Last updated on December 26, 2022