Links

Comptroller

Properties
Methods

Properties

sdk

The sdk instance used by the comptroller.
Type: MarketSDK

contract

The raw web3 contract instance for the comptroller.

address

Contract address of the comptroller.
Type: string

Methods

_become

Change the unitroller for the comptroller implementation.
Parameters:
  • unitroller: string - The new unitroller's address.
  • tx?: NonPayableTx - The transaction info object for making the transaction with.
Returns: Promise<TransactionReceipt>

_borrowGuardianPaused

Returns whether borrow guardian is paused.
Parameters:
  • tx?: NonPayableTx - The transaction info object for making the transaction with.
Returns: Promise<boolean>

_mintGuardianPaused

Returns whether mint guardian is paused.
Parameters:
  • tx?: NonPayableTx - The transaction info object for making the transaction with.
Returns: Promise<boolean>

_setBorrowPaused

Sets the borrowing status for a cToken.
Parameters:
  • cToken: CToken | string - The cToken to pause/resume the borrowing for.
  • state: boolean - Whether borrowing should be paused
  • tx?: NonPayableTx - The transaction info object for making the transaction with.
Returns: Promise<TransactionReceipt>

_setCloseFactor

Sets the close factor used when liquidating borrows.
Parameters:
  • newCloseFactorMantissa: number | string | BN - New close factor, scaled by 1e18.
  • tx?: NonPayableTx - The transaction info object for making the transaction with.
Returns: Promise<TransactionReceipt>

_setCollateralFactor

Sets the collateral factor for a market.
Parameters:
  • cToken:CToken| string - The market to set the factor on.
  • newCollateralFactorMantissa: number | string | BN - The new collateral factor, scaled by 1e18.
  • tx?: NonPayableTx - The transaction info object for making the transaction with.
Returns: Promise<TransactionReceipt>

_setLiquidationIncentive

Sets liquidation incentive.
Parameters:
  • newLiquidationIncentiveMantissa: number | string | BN - New liquidationIncentive scaled by 1e18
  • tx?: NonPayableTx - The transaction info object for making the transaction with.
Returns: Promise<TransactionReceipt>

_setMaxAssets

Sets maxAssets which controls how many markets can be entered.
Parameters:
  • newMaxAssets: number | string | BN - New max assets.
  • tx?: NonPayableTx - The transaction info object for making the transaction with.
Returns: Promise<TransactionReceipt>

_setMintPaused

Sets the mint status for a cToken.
Parameters:
  • cToken:CToken| string - The cToken to pause/resume minting for.
  • state: boolean - Whether minting should be paused for cToken.
  • tx?: NonPayableTx - The transaction info object for making the transaction with.
Returns: Promise<TransactionReceipt>

_setPauseGuardian

Admin function to change the Pause Guardian.
Parameters:
  • newPauseGuardian: string - The address of the new Pause Guardian.
  • tx?: NonPayableTx - The transaction info object for making the transaction with.
Returns: Promise<TransactionReceipt>

_setPriceOracle

Sets a new price oracle for the comptroller.
Parameters:
  • newOracle: string - New price oracle to use.
  • tx?: NonPayableTx - The transaction info object for making the transaction with.
Returns: Promise<TransactionReceipt>

_setSeizePaused

Change the seize status for the comptroller.
Parameters:
  • state: boolean - True for pause.
  • tx?: NonPayableTx - The transaction info object for making the transaction with.
Returns: Promise<TransactionReceipt>

_setTransferPaused

Parameters:
  • state: boolean - True for pause.
  • tx?: NonPayableTx - The transaction info object for making the transaction with.
Returns: Promise<TransactionReceipt>

_setWhitelistEnforcement

Sets the whitelist enforcement for the comptroller.
Parameters:
  • enforce: boolean - Whether to enforce the whitelist.
  • tx?: NonPayableTx - The transaction info object for making the transaction with.
Returns: Promise<TransactionReceipt>

_setWhitelistStatuses

Sets the whitelist statuses for suppliers.
Parameters:
  • suppliers: string[] - Array of supplies to update the statuses of.
  • statuses: boolean[] - New statuses for the suppliers.
  • tx?: NonPayableTx - The transaction info object for making the transaction with.
Returns: Promise<TransactionReceipt>

_supportMarket

Add the market to the markets mapping and set it as listed.
Parameters:
  • cToken:CToken| string - The address of the market (token) to list.
  • tx?: NonPayableTx - The transaction info object for making the transaction with.
Returns: Promise<TransactionReceipt>

_supportMarketAndSetCollateralFactor

Add the market to the markets mapping and set it as listed and set the collateral factor.
Parameters:
  • cToken:CToken| string - The address of the market (token) to list.
  • newCollateralFactorMantissa: number | string | BN - The new collateral factor, scaled by 1e18.
  • tx?: NonPayableTx - The transaction info object for making the transaction with.
Returns: Promise<TransactionReceipt>

_unsupportMarket

Removed a market from the markets mapping and sets it as unlisted.
Parameters:
  • cToken:CToken| string - The address of the market (token) to unlist
  • tx?: NonPayableTx - The transaction info object for making the transaction with.
Returns: Promise<TransactionReceipt>

accountAssets

Per-account mapping of "assets you are in", capped by maxAssets.
Parameters:
  • account: string -
  • cTokenIndex: number | string | BN -
  • tx?: NonPayableTx - The transaction info object for making the transaction with.
Returns: Promise<string>

admin

Returns the contract admin.
Parameters:
  • tx?: NonPayableTx - The transaction info object for making the transaction with.
Returns: Promise<string>

adminHasRights

Returns whether or not the admin has admin rights.
Parameters:
  • tx?: NonPayableTx - The transaction info object for making the transaction with.
Returns: Promise<boolean>

allBorrowers

A list of all borrowers who have entered markets.
Parameters:
  • index: number | string | BN - Borrower index.
  • tx?: NonPayableTx - The transaction info object for making the transaction with.
Returns: Promise<string>

allMarkets

Returns a CToken address based on the index.
Parameters:
  • index: number | string | BN - Index of the market to fetch.
  • tx?: NonPayableTx - The transaction info object for making the transaction with.
Returns: Promise<string>

borrowAllowed

Checks if the account should be allowed to borrow the underlying asset of the given market.
Parameters:
  • cToken:CToken| string - The market to verify the borrow against.
  • borrower: string - The account which would borrow the asset.
  • borrowAmount: number | string | BN - The amount of underlying the account would borrow.
  • tx?: NonPayableTx - The transaction info object for making the transaction with.
Returns: Promise<TransactionReceipt>

borrowGuardianPaused

Returns whether borrow guardian is paused for the cToken or not.
Parameters:
  • cToken:CToken| string - The cToken to fetch the guardian status of.
  • tx?: NonPayableTx - The transaction info object for making the transaction with.
Returns: Promise<boolean>

borrowVerify

Validates borrow and reverts on rejection. May emit logs.
Parameters:
  • cToken:CToken| string - Asset whose underlying is being borrowed.
  • borrower: string - The address borrowing the underlying.
  • borrowAmount: nnumber | string | BN - The amount of the underlying asset requested to borrow.
  • tx?: NonPayableTx - The transaction info object for making the transaction with.
Returns: Promise<TransactionReceipt>

borrowWithinLimits

Checks if the account should be allowed to borrow the underlying asset of the given market.
Parameters:
  • cToken:CToken| string - Asset whose underlying is being borrowed.
  • accountBorrowNew: number | string | BN - The user's new borrow balance of the underlying asset.
  • tx?: NonPayableTx - The transaction info object for making the transaction with.
Returns: Promise<TransactionReceipt>

cTokensUnderlying

Parameters:
  • underlying: string -
  • tx?: NonPayableTx - The transaction info object for making the transaction with.
Returns: Promise<string>

checkMembership

Returns whether the given account is entered in the given asset.
Parameters:
  • account: string - The address of the account to check.
  • cToken:CToken| string - The cToken to check.
  • tx?: NonPayableTx - The transaction info object for making the transaction with.
Returns: Promise<TransactionReceipt>

closeFactorMantissa

Returns the close factor mantissa for the pool.
Parameters:
  • tx?: NonPayableTx - The transaction info object for making the transaction with.
Returns: Promise<string>

comptrollerImplementation

Returns the comptroller implementation address for the unitroller.
Parameters:
  • tx?: NonPayableTx - The transaction info object for making the transaction with.
Returns: Promise<string>

enforceWhitelist

Returns whether or not the supplier whitelist is enforced.
Parameters:
  • tx?: NonPayableTx - The transaction info object for making the transaction with.
Returns: Promise<boolean>

enterMarkets

Add assets to be included in account liquidity calculation.
Parameters:
  • cTokens: (CToken | string)[] - The list of addresses of the cToken markets to be enabled
  • tx?: NonPayableTx - The transaction info object for making the transaction with.
Returns: Promise<TransactionReceipt>

exitMarket

Removes asset from sender's account liquidity calculation.
Parameters:
  • cToken:CToken| string - The address of the asset to be removed.
  • tx?: NonPayableTx - The transaction info object for making the transaction with.
Returns: Promise<TransactionReceipt>

fuseAdminHasRights

Returns whether or not the Fuse admin has admin rights.
Parameters:
  • tx?: NonPayableTx - The transaction info object for making the transaction with.
Returns: Promise<TransactionReceipt>

getAccountLiquidity

Returns the current account liquidity wrt collateral requirements.
Parameters:
  • account: string - The account to return the liquidity for.
  • tx?: NonPayableTx - The transaction info object for making the transaction with.
Returns: Promise<[string, string, string]>

getAllBorrowers

Return all of the borrowers.
Parameters:
  • tx?: NonPayableTx - The transaction info object for making the transaction with.
Returns: Promise<string[]>

getAllMarkets

Return all of the markets.
Parameters:
  • tx?: NonPayableTx - The transaction info object for making the transaction with.
Returns: Promise<string[]>

getAssetsIn

Returns the assets an account has entered.
Parameters:
  • account: string - The address of the account to pull assets for.
  • tx?: NonPayableTx - The transaction info object for making the transaction with.
Returns: Promise<string[]>

getHypotheticalAccountLiquidity

Determine what the account liquidity would be if the given amounts were redeemed/borrowed.
Parameters:
  • account: string - The account to determine liquidity for.
  • cTokenModify:CToken| string - The market to hypothetically redeem/borrow in.
  • redeemTokens: number | string | BN - The number of tokens to hypothetically redeem.
  • borrowAmount: number | string | BN - The amount of underlying to hypothetically borrow.
  • tx?: NonPayableTx - The transaction info object for making the transaction with.
Returns: Promise<[string, string, string]>

getMaxBorrow

Determine the maximum borrow amount of a cToken.
Parameters:
  • account: string - The account to determine liquidity for.
  • cTokenModify:CToken| string - The market to hypothetically borrow in.
  • tx?: NonPayableTx - The transaction info object for making the transaction with.
Returns: Promise<[string, string]>

getMaxRedeem

Determine the maximum redeem amount of a cToken.
Parameters:
  • account: string - The account to determine liquidity for.
  • cTokenModify:CToken| string - The market to hypothetically redeem in.
  • tx?: NonPayableTx - The transaction info object for making the transaction with.
Returns: Promise<[string, string]>

getWhitelist

Return all of the whitelist.
Parameters:
  • tx?: NonPayableTx - The transaction info object for making the transaction with.
Returns: Promise<string[]>

isComptroller

Parameters:
  • tx?: NonPayableTx - The transaction info object for making the transaction with.
Returns: Promise<boolean>

liquidateBorrowAllowed

Checks if the liquidation should be allowed to occur.
Parameters:
  • cTokenBorrowed:CToken| string - Asset which was borrowed by the borrower.
  • cTokenCollateral:CToken| string - Asset which was used as collateral and will be seized.
  • liquidator: string - The address repaying the borrow and seizing the collateral.
  • borrower: string - The address of the borrower,
  • repayAmount: number | string | BN - The amount of underlying being repaid.
  • tx?: NonPayableTx - The transaction info object for making the transaction with.
Returns: Promise<TransactionReceipt>

liquidateBorrowVerify

Parameters:
  • cTokenBorrowed:CToken| string - Asset which was borrowed by the borrower.
  • cTokenCollateral:CToken| string - Asset which was used as collateral and will be seized.
  • liquidator: string - The address repaying the borrow and seizing the collateral.
  • borrower: string - The address of the borrower.
  • actualRepayAmount: number | string | BN - The amount of underlying being repaid.
  • seizeTokens: number | string | BN -
  • tx?: NonPayableTx - The transaction info object for making the transaction with.
Returns: Promise<TransactionReceipt>

liquidateCalculateSeizeTokens

Calculate number of tokens of collateral asset to seize given an underlying amount.
Parameters:
  • cTokenBorrowed:CToken| string - The address of the borrowed cToken.
  • cTokenCollateral:CToken| string - The address of the collateral cToken.
  • accountRepayAmount: number | string | BN - The amount of cTokenBorrowed underlying to convert into cTokenCollateral tokens.
  • tx?: NonPayableTx - The transaction info object for making the transaction with.
Returns: Promise<TransactionReceipt>

liquidationIncentiveMantissa

Returns the liquidation incentive mantissa.
Parameters:
  • tx?: NonPayableTx - The transaction info object for making the transaction with.
Returns: Promise<string>

markets

Mapping of cTokens -> Market metadata
Parameters:
  • cToken:CToken| string - The cToken to get the Market for.
  • tx?: NonPayableTx - The transaction info object for making the transaction with.
Returns: Promise<{ isListed: boolean; collateralFactorMantissa: string }>

maxAssets

Returns the max number of assets a single account can participate in (borrow or use as collateral).
Parameters:
  • tx?: NonPayableTx - The transaction info object for making the transaction with.
Returns: Promise<string>

mintAllowed

Checks if the account should be allowed to mint tokens in the given market.
Parameters:
  • cToken:CToken| string - The market to verify the mint against.
  • minter: string - The account which would get the minted tokens.
  • mintAmount: number | string | BN - The amount of underlying being supplied to the market in exchange for tokens.
  • tx?: NonPayableTx - The transaction info object for making the transaction with.
Returns: Promise<TransactionReceipt>

mintGuardianPaused

Returns whether the mint guardian is paused for a market.
Parameters:
  • cToken:CToken| string - The cToken to check the mint guardian for.
  • tx?: NonPayableTx - The transaction info object for making the transaction with.
Returns: Promise<boolean>

mintVerify

Validates mint and reverts on rejection.
Parameters:
  • cToken:CToken| string - Asset being minted.
  • minter: string - The address minting the tokens.
  • actualMintAmount: number | string | BN - The amount of the underlying asset being minted.
  • mintTokens: number | string | BN - The number of tokens being minted.
  • tx?: NonPayableTx - The transaction info object for making the transaction with.
Returns: Promise<TransactionReceipt>

mintWithinLimits

Checks if the account should be allowed to borrow the underlying asset of the given market.
Parameters:
  • cToken:CToken| string - Asset whose underlying is being borrowed.
  • minter: string -
  • actualMintAmount: number | string | BN -
  • mintTokens: number | string | BN -
  • tx?: NonPayableTx - The transaction info object for making the transaction with.
Returns: Promise<TransactionReceipt>

oracle

Returns the price oracle used by the comptroller.
Parameters:
  • tx?: NonPayableTx - The transaction info object for making the transaction with.
Returns: Promise<string>

pauseGuardian

Returns the current pause guardian.
Parameters:
  • tx?: NonPayableTx - The transaction info object for making the transaction with.
Returns: Promise<string>

pendingAdmin

Returns the pending admin for this contract.
Parameters:
  • tx?: NonPayableTx - The transaction info object for making the transaction with.
Returns: Promise<string>

pendingComptrollerImplementation

Returns the pending comptroller implementation for the unitroller.
Parameters:
  • tx?: NonPayableTx - The transaction info object for making the transaction with.
Returns: Promise<string>

redeemAllowed

Checks if the account should be allowed to redeem tokens in the given market.
Parameters:
  • cToken: CToken| string - The market to verify the redeem against.
  • redeemer: string - The account which would redeem the tokens.
  • redeemTokens: number | string | BN - The number of cTokens to exchange for the underlying asset in the market.
  • tx?: NonPayableTx - The transaction info object for making the transaction with.
Returns: Promise<TransactionReceipt>

redeemVerify

Validates redeem and reverts on rejection. May emit logs.
Parameters:
  • cToken:CToken| string - Asset being redeemed.
  • redeemer: string - The address redeeming the tokens.
  • redeemAmount: number | string | BN - The amount of the underlying asset being redeemed.
  • redeemTokens: number | string | BN - The number of tokens being redeemed.
  • tx?: NonPayableTx - The transaction info object for making the transaction with.
Returns: Promise<TransactionReceipt>

repayBorrowAllowed

Checks if the account should be allowed to repay a borrow in the given market.
Parameters:
  • cToken:CToken| string - The market to verify the repay against.
  • payer: string - The account which would repay the asset.
  • borrower: string - The account which would borrowed the asset.
  • repayAmount: number | string | BN - The amount of the underlying asset the account would repay.
  • tx?: NonPayableTx - The transaction info object for making the transaction with.
Returns: Promise<TransactionReceipt>

repayBorrowVerify

Validates repayBorrow and reverts on rejection.
Parameters:
  • cToken:CToken| string - Asset being repaid.
  • payer: string -
  • borrower: string -
  • actualRepayAmount: number | string | BN -
  • borrowerIndex: number | string | BN -
  • tx?: NonPayableTx - The transaction info object for making the transaction with.
Returns: Promise<TransactionReceipt>

seizeAllowed

Checks if the seizing of assets should be allowed to occur.
Parameters:
  • cTokenBorrowed:CToken| string - Asset which was used as collateral and will be seized.
  • cTokenCollateral:CToken| string - Asset which was borrowed by the borrower.
  • liquidator: string - The address repaying the borrow and seizing the collateral.
  • borrower: string - The address of the borrower.
  • seizeTokens: number | string | BN - The number of collateral tokens to seize.
  • tx?: NonPayableTx - The transaction info object for making the transaction with.
Returns: Promise<TransactionReceipt>

seizeGuardianPaused

Parameters:
  • tx?: NonPayableTx - The transaction info object for making the transaction with.
Returns: Promise<boolean>

seizeVerify

Validates seize and reverts on rejection.
Parameters:
  • cTokenBorrowed:CToken| string - Asset which was borrowed by the borrower.
  • cTokenCollateral: CToken| string - Asset which was used as collateral and will be seized.
  • liquidator: string - The address repaying the borrow and seizing the collateral.
  • borrower: string - The address of the borrower.
  • seizeTokens: number | string | BN - The number of collateral tokens to seize.
  • tx?: NonPayableTx - The transaction info object for making the transaction with.
Returns: Promise<TransactionReceipt>

suppliers

Returns whether a supplier has ever supplied to any market.
Parameters:
  • supplier: string - The supplier to check.
  • tx?: NonPayableTx - The transaction info object for making the transaction with.
Returns: Promise<boolean>

transferAllowed

Checks if the account should be allowed to transfer tokens in the given market.
Parameters:
  • cToken: CToken | string - The market to verify the transfer against.
  • src: string - The account which sources the tokens.
  • dst: string - The account which receives the tokens.
  • transferTokens: number | string | BN - The number of cTokens to transfer.
  • tx?: NonPayableTx - The transaction info object for making the transaction with.
Returns: Promise<TransactionReceipt>

transferGuardianPaused

Parameters:
  • tx?: NonPayableTx - The transaction info object for making the transaction with.
Returns: Promise<boolean>

transferVerify

Validates transfer and reverts on rejection.
Parameters:
  • cToken: CToken | string - Asset being transferred.
  • src: string - The account which sources the tokens.
  • dst: string - The account which receives the tokens.
  • transferTokens: number | string | BN - The number of cTokens to transfer.
  • tx?: NonPayableTx - The transaction info object for making the transaction with.
Returns: Promise<TransactionReceipt>

whitelist

Returns whether an account is allowed to supply assets or not.
Parameters:
  • account: string - The account to check the whitelist status for.
  • tx?: NonPayableTx - The transaction info object for making the transaction with.
Returns: Promise<boolean>

whitelistArray

An array of all whitelisted accounts.
Parameters:
  • index: number | string | BN - Index of the account to fetch.
  • tx?: NonPayableTx - The transaction info object for making the transaction with.
Returns: Promise<TransactionReceipt>