VToken

Venus's vToken Contract

Abstract base for vTokens

Solidity API

struct MintLocalVars {
  enum CarefulMath.MathError mathErr;
  uint256 exchangeRateMantissa;
  uint256 mintTokens;
  uint256 totalSupplyNew;
  uint256 accountTokensNew;
  uint256 actualMintAmount;
}
struct RedeemLocalVars {
  enum CarefulMath.MathError mathErr;
  uint256 exchangeRateMantissa;
  uint256 redeemTokens;
  uint256 redeemAmount;
  uint256 totalSupplyNew;
  uint256 accountTokensNew;
}
struct BorrowLocalVars {
  enum CarefulMath.MathError mathErr;
  uint256 accountBorrows;
  uint256 accountBorrowsNew;
  uint256 totalBorrowsNew;
}
struct RepayBorrowLocalVars {
  enum TokenErrorReporter.Error err;
  enum CarefulMath.MathError mathErr;
  uint256 repayAmount;
  uint256 borrowerIndex;
  uint256 accountBorrows;
  uint256 accountBorrowsNew;
  uint256 totalBorrowsNew;
  uint256 actualRepayAmount;
}

transfer

Transfer amount tokens from msg.sender to dst

function transfer(address dst, uint256 amount) external returns (bool)

Parameters

Return Values


transferFrom

Transfer amount tokens from src to dst

function transferFrom(address src, address dst, uint256 amount) external returns (bool)

Parameters

Return Values


approve

Approve spender to transfer up to amount from src

function approve(address spender, uint256 amount) external returns (bool)

Parameters

Return Values


balanceOfUnderlying

Get the underlying balance of the owner

function balanceOfUnderlying(address owner) external returns (uint256)

Parameters

Return Values


totalBorrowsCurrent

Returns the current total borrows plus accrued interest

function totalBorrowsCurrent() external returns (uint256)

Return Values


borrowBalanceCurrent

Accrue interest to updated borrowIndex and then calculate account's borrow balance using the updated borrowIndex

function borrowBalanceCurrent(address account) external returns (uint256)

Parameters

Return Values


seize

Transfers collateral tokens (this market) to the liquidator.

function seize(address liquidator, address borrower, uint256 seizeTokens) external returns (uint256)

Parameters

Return Values


_setPendingAdmin

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

function _setPendingAdmin(address payable newPendingAdmin) external returns (uint256)

Parameters

Return Values


_acceptAdmin

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

function _acceptAdmin() external returns (uint256)

Return Values


_setReserveFactor

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

function _setReserveFactor(uint256 newReserveFactorMantissa_) external returns (uint256)

Return Values


setAccessControlManager

Sets the address of the access control manager of this contract

function setAccessControlManager(address newAccessControlManagerAddress) external returns (uint256)

Parameters

Return Values


_reduceReserves

Accrues interest and reduces reserves by transferring to protocol share reserve

function _reduceReserves(uint256 reduceAmount_) external returns (uint256)

Parameters

Return Values


allowance

Get the current allowance from owner for spender

function allowance(address owner, address spender) external view returns (uint256)

Parameters

Return Values


balanceOf

Get the token balance of the owner

function balanceOf(address owner) external view returns (uint256)

Parameters

Return Values


getAccountSnapshot

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

function getAccountSnapshot(address account) external view returns (uint256, uint256, uint256, uint256)

Parameters

Return Values


supplyRatePerBlock

Returns the current per-block supply interest rate for this vToken

function supplyRatePerBlock() external view returns (uint256)

Return Values


borrowRatePerBlock

Returns the current per-block borrow interest rate for this vToken

function borrowRatePerBlock() external view returns (uint256)

Return Values


getCash

Get cash balance of this vToken in the underlying asset

function getCash() external view returns (uint256)

Return Values


setReduceReservesBlockDelta

Governance function to set new threshold of block difference after which funds will be sent to the protocol share reserve

function setReduceReservesBlockDelta(uint256 newReduceReservesBlockDelta_) external returns (uint256)

Parameters


setProtocolShareReserve

Sets protocol share reserve contract address

function setProtocolShareReserve(address payable protcolShareReserve_) external returns (uint256)

Parameters


initialize

Initialize the money market

function initialize(contract ComptrollerInterface comptroller_, contract InterestRateModel interestRateModel_, uint256 initialExchangeRateMantissa_, string name_, string symbol_, uint8 decimals_) public

Parameters


exchangeRateCurrent

Accrue interest then return the up-to-date exchange rate

function exchangeRateCurrent() public returns (uint256)

Return Values


accrueInterest

Applies accrued interest to total borrows and reserves

function accrueInterest() public returns (uint256)

_setComptroller

Sets a new comptroller for the market

function _setComptroller(contract ComptrollerInterface newComptroller) public returns (uint256)

Return Values


_setInterestRateModel

Accrues interest and updates the interest rate model using _setInterestRateModelFresh

function _setInterestRateModel(contract InterestRateModel newInterestRateModel_) public returns (uint256)

Parameters

Return Values


exchangeRateStored

Calculates the exchange rate from the underlying to the VToken

function exchangeRateStored() public view returns (uint256)

Return Values


borrowBalanceStored

Return the borrow balance of account based on stored data

function borrowBalanceStored(address account) public view returns (uint256)

Parameters

Return Values


Last updated