BToken
Overview
License: MIT
Author: Compound Abstract base for CTokens
Structs info
MintLocalVars
RedeemLocalVars
BorrowLocalVars
RepayBorrowLocalVars
Modifiers info
nonReentrant
Prevents a contract from calling itself, directly or indirectly.
Functions info
initialize (0x99d8c1b4)
Initializes the money market.
Parameters:
bondtroller_
contract Bondtroller
The address of the Bondtroller.
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.
transfer (0xa9059cbb)
Transfers 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 (0x23b872dd)
Transfers 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 (0x095ea7b3)
Approves spender
to transfer up to amount
from src
. This will overwrite the approval amount for spender
and is subject to issues noted here.
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.
allowance (0xdd62ed3e)
Gets 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 (0x70a08231)
Gets 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
.
balanceOfUnderlying (0x3af9e669)
Gets the underlying balance of the owner
. This also accrues interest in a transaction.
Parameters:
owner
address
The address of the account to query.
Return values:
[0]
uint256
The amount of underlying owned by owner
.
balanceOfUnderlyingView (0x439d3ee7)
Returns the balance of the underlying asset of this bToken for the given account. This is a view function, which means it will not modify the blockchain state.
Parameters:
owner
address
The address of the account to query.
Return values:
[0]
uint256
The balance of the underlying asset of this bToken for the given account.
getAccountSnapshot (0xc37f68e2)
Gets a snapshot of the account's balances, and the cached exchange rate. This is used by bondtroller to more efficiently perform liquidity checks.
Parameters:
account
address
Address of the account to snapshot
Return values:
[0]
uint256
(possible error, token balance, borrow balance, exchange rate mantissa)
borrowRatePerBlock (0xf8f9da28)
Returns the current per-block borrow interest rate for this cToken.
Return values:
[0]
uint256
The borrow interest rate per block, scaled by 1e18.
supplyRatePerBlock (0xae9d70b0)
Returns the current per-block supply interest rate for this cToken.
Return values:
[0]
uint256
The supply interest rate per block, scaled by 1e18.
totalBorrowsCurrent (0x73acee98)
Returns the current total borrows plus accrued interest.
Return values:
[0]
uint256
The total borrows with interest.
borrowBalanceCurrent (0x17bfdfbc)
Accrues 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.
borrowBalanceStored (0x95dd9193)
Returns 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.
exchangeRateCurrent (0xbd6d894d)
Accrues interest then return the up-to-date exchange rate.
Return values:
[0]
uint256
Calculated exchange rate scaled by 1e18.
exchangeRateStored (0x182df0f5)
Calculates the exchange rate from the underlying to the CToken.
Return values:
[0]
uint256
Calculated exchange rate scaled by 1e18.
getCash (0x3b1d21a2)
Gets cash balance of this cToken in the underlying asset.
Return values:
[0]
uint256
The quantity of underlying asset owned by this contract.
accrueInterest (0xa6afed95)
Applies accrued interest to total borrows and reserves. This calculates interest accrued from the last checkpointed block up to the current block and writes new checkpoint to storage.
_setBondtroller (0xb4ac7688)
Sets a new bondtroller for the market. Admin function to set a new bondtroller.
Return values:
[0]
uint256
uint256 0=success, otherwise a failure (see ErrorReporter.sol for details).
_setReserveFactor (0xfca7820b)
Accrues interest and sets a new reserve factor for the protocol using _setReserveFactorFresh. Admin function to accrue interest and set a new reserve factor.
Return values:
[0]
uint256
uint256 0=success, otherwise a failure (see ErrorReporter.sol for details).
_reduceReserves (0x601a0bf1)
Accrues interest and reduces reserves by transferring to moderator.
Parameters:
reduceAmount
uint256
Amount of reduction to reserves.
Return values:
[0]
uint256
uint256 0=success, otherwise a failure (see ErrorReporter.sol for details).
_setInterestRateModel (0xf2b3abbd)
accrues interest and updates the interest rate model using _setInterestRateModelFresh. Admin function to accrue interest and update the interest rate model.
Parameters:
newInterestRateModel
contract InterestRateModel
the new interest rate model to use.
Return values:
[0]
uint256
uint256 0=success, otherwise a failure (see ErrorReporter.sol for details).
hasRoleModerator (0xd6526889)
Returns whether the specified account has the moderator role.
Parameters:
account
address
The address to check for moderator role.
Return values:
[0]
bool
A boolean indicating whether the account has the moderator role.
Last updated