VToken
Venus's vToken Contract
Abstract base for vTokens
Solidity API
transfer
Transfer amount
tokens from msg.sender
to dst
Parameters
dst
address
The address of the destination account
amount
uint256
The number of tokens to transfer
Return Values
[0]
bool
Whether or not the transfer succeeded
transferFrom
Transfer amount
tokens from src
to dst
Parameters
src
address
The address of the source account
dst
address
The address of the destination account
amount
uint256
The number of tokens to transfer
Return Values
[0]
bool
Whether or not the transfer succeeded
approve
Approve spender
to transfer up to amount
from src
Parameters
spender
address
The address of the account which may transfer tokens
amount
uint256
The number of tokens that are approved (-1 means infinite)
Return Values
[0]
bool
Whether or not the approval succeeded
balanceOfUnderlying
Get the underlying balance of the owner
Parameters
owner
address
The address of the account to query
Return Values
[0]
uint256
The amount of underlying owned by owner
totalBorrowsCurrent
Returns the current total borrows plus accrued interest
Return Values
[0]
uint256
The total borrows with interest
borrowBalanceCurrent
Accrue interest to updated borrowIndex and then calculate account's borrow balance using the updated borrowIndex
Parameters
account
address
The address whose balance should be calculated after updating borrowIndex
Return Values
[0]
uint256
The calculated balance
seize
Transfers collateral tokens (this market) to the liquidator.
Parameters
liquidator
address
The account receiving seized collateral
borrower
address
The account having collateral seized
seizeTokens
uint256
The number of vTokens to seize
Return Values
[0]
uint256
uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).
_setPendingAdmin
Begins transfer of admin rights. The newPendingAdmin must call _acceptAdmin
to finalize the transfer.
Parameters
newPendingAdmin
address payable
New pending admin.
Return Values
[0]
uint256
uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).
_acceptAdmin
Accepts transfer of admin rights. msg.sender must be pendingAdmin
Return Values
[0]
uint256
uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).
_setReserveFactor
accrues interest and sets a new reserve factor for the protocol using _setReserveFactorFresh
Return Values
[0]
uint256
uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).
setAccessControlManager
Sets the address of the access control manager of this contract
Parameters
newAccessControlManagerAddress
address
New address for the access control
Return Values
[0]
uint256
uint 0=success, otherwise will revert
_reduceReserves
Accrues interest and reduces reserves by transferring to protocol share reserve
Parameters
reduceAmount_
uint256
Amount of reduction to reserves
Return Values
[0]
uint256
uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).
allowance
Get the current allowance from owner
for spender
Parameters
owner
address
The address of the account which owns the tokens to be spent
spender
address
The address of the account which may transfer tokens
Return Values
[0]
uint256
The number of tokens allowed to be spent (-1 means infinite)
balanceOf
Get the token balance of the owner
Parameters
owner
address
The address of the account to query
Return Values
[0]
uint256
The number of tokens owned by owner
getAccountSnapshot
Get a snapshot of the account's balances, and the cached exchange rate
Parameters
account
address
Address of the account to snapshot
Return Values
[0]
uint256
(possible error, token balance, borrow balance, exchange rate mantissa)
[1]
uint256
[2]
uint256
[3]
uint256
supplyRatePerBlock
Returns the current per-block supply interest rate for this vToken
Return Values
[0]
uint256
The supply interest rate per block, scaled by 1e18
borrowRatePerBlock
Returns the current per-block borrow interest rate for this vToken
Return Values
[0]
uint256
The borrow interest rate per block, scaled by 1e18
getCash
Get cash balance of this vToken in the underlying asset
Return Values
[0]
uint256
The quantity of underlying asset owned by this contract
setReduceReservesBlockDelta
Governance function to set new threshold of block difference after which funds will be sent to the protocol share reserve
Parameters
newReduceReservesBlockDelta_
uint256
block difference value
setProtocolShareReserve
Sets protocol share reserve contract address
Parameters
protcolShareReserve_
address payable
The address of protocol share reserve contract
initialize
Initialize the money market
Parameters
comptroller_
contract ComptrollerInterface
The address of the Comptroller
interestRateModel_
contract InterestRateModel
The address of the interest rate model
initialExchangeRateMantissa_
uint256
The initial exchange rate, scaled by 1e18
name_
string
EIP-20 name of this token
symbol_
string
EIP-20 symbol of this token
decimals_
uint8
EIP-20 decimal precision of this token
exchangeRateCurrent
Accrue interest then return the up-to-date exchange rate
Return Values
[0]
uint256
Calculated exchange rate scaled by 1e18
accrueInterest
Applies accrued interest to total borrows and reserves
_setComptroller
Sets a new comptroller for the market
Return Values
[0]
uint256
uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).
_setInterestRateModel
Accrues interest and updates the interest rate model using _setInterestRateModelFresh
Parameters
newInterestRateModel_
contract InterestRateModel
The new interest rate model to use
Return Values
[0]
uint256
uint Returns 0 on success, otherwise returns a failure code (see ErrorReporter.sol for details).
exchangeRateStored
Calculates the exchange rate from the underlying to the VToken
Return Values
[0]
uint256
Calculated exchange rate scaled by 1e18
borrowBalanceStored
Return the borrow balance of account based on stored data
Parameters
account
address
The address whose balance should be calculated
Return Values
[0]
uint256
The calculated balance
Last updated