CToken

Properties
Methods

Properties

sdk

The sdk instance used by the cToken.

Type: MarketSDK

contract

The raw web3 contract instance for the cToken.

Type: web3.eth.Contract

address

Contract address of the cToken.

Type: string

Methods

_acceptAdmin

Accepts transfer of admin rights. msg.sender must be pendingAdmin.

Parameters:

  • tx?: NonPayableTx - The transaction info object for making the transaction with.

Returns: Promise<TransactionReceipt>

_reduceReserves

Accrues interest and reduces reserves by transferring to admin.

Parameters:

  • reduceAmount: number | string | BN - Amount of reduction to reserves.

  • tx?: NonPayableTx - The transaction info object for making the transaction with.

Returns: Promise<TransactionReceipt>

_renounceReserves

Parameters:

  • tx?: NonPayableTx - The transaction info object for making the transaction with.

Returns: Promise<TransactionReceipt>

_renounceAdminRights

Renounce admin rights.

Parameters:

  • tx?: NonPayableTx - The transaction info object for making the transaction with.

Returns: Promise<TransactionReceipt>

_renounceFuseAdminRights

Renounce the Fuse admin rights.

Parameters:

  • tx?: NonPayableTx - The transaction info object for making the transaction with.

Returns: Promise<TransactionReceipt>

_setAdminFee

Accrues interest and sets a new admin fee for the protocol using _setAdminFeeFresh.

Parameters:

  • newAdminFeeMantissa: number | string | BN -

  • tx?: NonPayableTx - The transaction info object for making the transaction with.

Returns: Promise<TransactionReceipt>

_setComptroller

Sets a new comptroller for the market.

Parameters:

  • newComptroller: Comptroller| string -

  • tx?: NonPayableTx - The transaction info object for making the transaction with.

Returns: Promise<TransactionReceipt>

_setFuseFee

Accrues interest and sets a new Fuse fee for the protocol using _setFuseFeeFresh.

Parameters:

  • tx?: NonPayableTx - The transaction info object for making the transaction with.

Returns: Promise<TransactionReceipt>

_setInterestRateModel

Updates the interest rate model (*requires fresh interest accrual)

Parameters:

  • newInterestRateModel: string - The new interest rate model to use.

  • tx?: NonPayableTx - The transaction info object for making the transaction with.

Returns: Promise<TransactionReceipt>

_setPendingAdmin

Begins transfer of admin rights. The newPendingAdmin must call _acceptAdmin to finalize the transfer.

Parameters:

  • newPendingAdmin: string - New pending admin.

  • tx?: NonPayableTx - The transaction info object for making the transaction with.

Returns: Promise<TransactionReceipt>

_setReserveFactor

Accrues interest and sets a new reserve factor for the protocol using _setReserveFactorFresh.

Parameters:

  • newReserveFactorMantissa: number | string | BN - New reserve factor.

  • tx?: NonPayableTx - The transaction info object for making the transaction with.

Returns: Promise<TransactionReceipt>

_withdrawAdminFees

Accrues interest and reduces admin fees by transferring to admin.

Parameters:

  • withdrawAmount: number | string | BN - Amount of fees to withdraw.

  • tx?: NonPayableTx - The transaction info object for making the transaction with.

Returns: Promise<TransactionReceipt>

_withdrawFuseFees

Accrues interest and reduces Fuse fees by transferring to Fuse.

Parameters:

  • withdrawAmount: number | string | BN - Amount of fees to withdraw.

  • tx?: NonPayableTx - The transaction info object for making the transaction with.

Returns: Promise<TransactionReceipt>

accrualBlockNumber

Returns the block number that interest was last accrued at.

Parameters:

  • tx?: NonPayableTx - The transaction info object for making the transaction with.

Returns: Promise<string>

accrualInterest

Parameters:

  • tx?: NonPayableTx - The transaction info object for making the transaction with.

Returns: Promise<string>

admin

Parameters:

  • tx?: NonPayableTx - The transaction info object for making the transaction with.

Returns: Promise<string>

adminFeeMantissa

Returns the fraction of interest currently set aside for admin fees.

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>

allowance

Returns the allowance for spender by owner.

Parameters:

  • owner: string - Owner of the allowance account.

  • spender: string - Spender of the allowance.

  • tx?: NonPayableTx - The transaction info object for making the transaction with.

Returns: Promise<string>

approve

Gives allowance to spender.

Parameters:

  • spender: string - Account to give allowance to.

  • amount: number | string | BN - Amount of allowance.

  • tx?: NonPayableTx - The transaction info object for making the transaction with.

Returns: Promise<TransactionReceipt>

balanceOf

Returns the balance of an account.

Parameters:

  • owner: string - The account address to get the balance of.

  • tx?: NonPayableTx - The transaction info object for making the transaction with.

Returns: Promise<string>

balanceOfUnderdyling

Returns the balance of the underlying token for a given account.

Parameters:

  • owner: string - The account to get the balance of.

  • tx?: NonPayableTx - The transaction info object for making the transaction with.

Returns: Promise<TransactionReceipt>

borrow

Borrows an asset.

Parameters:

  • borrowAmount: number | string | BN - Amount to borrow.

  • tx?: NonPayableTx - The transaction info object for making the transaction with.

Returns: Promise<TransactionReceipt>

borrowBalanceCurrent

Returns the borrow balance for an account.

Parameters:

  • account: string - The account to get the borrow balance of.

  • tx?: NonPayableTx - The transaction info object for making the transaction with.

Returns: Promise<string>

borrowBalanceStored

Returns the stored borrow balance for an account.

Parameters:

  • account: string - The account to get thee balance of.

  • tx?: NonPayableTx - The transaction info object for making the transaction with.

Returns: Promise<string>

borrowIndex

Returns the borrow Index for the cToken. Borrow index is the accumulator of total earned interest rate since the opening of the market.

Parameters:

  • tx?: NonPayableTx - The transaction info object for making the transaction with.

Returns: Promise<string>

borrowRatePerBlock

Returns the borrow rate per block.

Parameters:

  • tx?: NonPayableTx - The transaction info object for making the transaction with.

Returns: Promise<string>

decimals

EIP-20 token decimals for this token.

Parameters:

  • tx?: NonPayableTx - The transaction info object for making the transaction with.

Returns: Promise<string>

exchangeRateCurrent

Returns the current exchange rate for the cToken.

Parameters:

  • tx?: NonPayableTx - The transaction info object for making the transaction with.

Returns: Promise<string>

exchangeRateStored

Returns the stored exchange rate for the cToken.

Parameters:

  • tx?: NonPayableTx - The transaction info object for making the transaction with.

Returns: Promise<string>

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<boolean>

fuseFeeMantissa

Returns the fuse fee.

Parameters:

  • tx?: NonPayableTx - The transaction info object for making the transaction with.

Returns: Promise<string>

getAccountSnapshot

Returns a snapshot of the account's balances, and the cached exchange rate.

Parameters:

  • account: string - Address of the account to snapshot.

  • tx?: NonPayableTx - The transaction info object for making the transaction with.

Returns: Promise<[string, string, string, string]>

getCash

Returns cash balance of the cToken in the underlying asset

Parameters:

  • tx?: NonPayableTx - The transaction info object for making the transaction with.

Returns: Promise<string>

interestRateModel

Parameters:

  • tx?: NonPayableTx - The transaction info object for making the transaction with.

Returns: Promise<string>

isCEther

Returns whether this is a CEther contract (for inspection).

Parameters:

  • tx?: NonPayableTx - The transaction info object for making the transaction with.

Returns: Promise<boolean>

isCToken

Returns whether this is a CToken contract (for inspection).

Parameters:

  • tx?: NonPayableTx - The transaction info object for making the transaction with.

Returns: Promise<boolean>

liquidateBorrow

Liquidates the borrowers' collateral.

Parameters:

  • borrower: string - The borrower of this cToken to be liquidated

  • repayAmount: number | string | BN - The amount of the underlying borrowed asset to repay.

  • cTokenCollateral:CToken| string - The market in which to seize collateral from the borrower.

  • tx?: NonPayableTx - The transaction info object for making the transaction with.

Returns: Promise<TransactionReceipt>

mint

Supplies assets into the market, receiving cTokens in exchange

Parameters:

  • mintAmount: number | string | BN - The amount of the underlying asset to supply.

  • tx?: NonPayableTx - The transaction info object for making the transaction with.

Returns: Promise<TransactionReceipt>

name

Returns ERC-20 name of this token.

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>

redeem

Redeems cTokens in exchange for the underlying asset.

Parameters:

  • redeemTokens: number | string | BN - The number of cTokens to redeem into underlying.

  • tx?: NonPayableTx - The transaction info object for making the transaction with.

Returns: Promise<TransactionReceipt>

redeemUnderlying

Redeems cTokens in exchange for a specified amount of underlying asset.

Parameters:

  • redeemAmount: number | string | BN -

  • tx?: NonPayableTx - The transaction info object for making the transaction with.

Returns: Promise<TransactionReceipt>

repayBorrow

Parameters:

  • redeemAmount: number | string | BN - The amount of underlying to redeem.

  • tx?: NonPayableTx - The transaction info object for making the transaction with.

Returns: Promise<TransactionReceipt>

repayBorrowBehalf

Repays a borrow belonging to borrower.

Parameters:

  • borrower: string - The account with the debt being payed off.

  • repayAmount: number | string | BN - The amount to repay.

  • tx?: NonPayableTx - The transaction info object for making the transaction with.

Returns: Promise<TransactionReceipt>

reserveFactorMantissa

Parameters:

  • tx?: NonPayableTx - The transaction info object for making the transaction with.

Returns: Promise<string>

seize

Transfers collateral tokens (this market) to the liquidator.

Parameters:

  • liquidator: string - The account receiving seized collateral.

  • borrower: string - The account having collateral seized.

  • seizeTokens: number | string | BN - The number of cTokens to seize.

  • tx?: NonPayableTx - The transaction info object for making the transaction with.

Returns: Promise<TransactionReceipt>

supplyRatePerBlock

Returns the current per-block supply interest rate for this cToken.

Parameters:

  • tx?: NonPayableTx - The transaction info object for making the transaction with.

Returns: Promise<string>

symbol

Returns the EIP-20 symbol of this token.

Parameters:

  • tx?: NonPayableTx - The transaction info object for making the transaction with.

Returns: Promise<string>

totalAdminFees

Returns the total amount of admin fees of the underlying held in this market.

Parameters:

  • tx?: NonPayableTx - The transaction info object for making the transaction with.

Returns: Promise<string>

totalBorrows

Returns the total amount of outstanding borrows of the underlying in this market.

Parameters:

  • tx?: NonPayableTx - The transaction info object for making the transaction with.

Returns: Promise<string>

totalBorrowsCurrent

Parameters:

  • tx?: NonPayableTx - The transaction info object for making the transaction with.

Returns: Promise<string>

totalFuseFees

Returns the total amount of Fuse fees of the underlying held in this market.

Parameters:

  • tx?: NonPayableTx - The transaction info object for making the transaction with.

Returns: Promise<string>

totalReserves

Returns the total amount of reserves of the underlying held in this market.

Parameters:

  • tx?: NonPayableTx - The transaction info object for making the transaction with.

Returns: Promise<string>

totalSupply

Returns the total number of tokens in circulation.

Parameters:

  • tx?: NonPayableTx - The transaction info object for making the transaction with.

Returns: Promise<string>

transfer

EIP20 transfer function.

Parameters:

  • dst: string - Account to transfer to.

  • amount: number | string | BN - Amount to transfer.

  • tx?: NonPayableTx - The transaction info object for making the transaction with.

Returns: Promise<TransactionReceipt>

transferFrom

EIP20 transferFrom function.

Parameters:

  • src: string - Account to transfer from.

  • dst: string - Account to transfer to.

  • amount: number | string | BN - Amount to transfer.

  • tx?: NonPayableTx - The transaction info object for making the transaction with.

Returns: Promise<TransactionReceipt>

underlying

Returns the underlying asset for this cToken.

Parameters:

  • tx?: NonPayableTx - The transaction info object for making the transaction with.

Returns: Promise<string>

Last updated