BLendingToken

Overview

License: MIT

contract BLendingToken is Initializable, BErc20, AccessControlUpgradeable

The BLendingToken contract

Events info

SetPrimaryLendingPlatform

event SetPrimaryLendingPlatform(address indexed oldPrimaryLendingPlatform, address indexed newPrimaryLendingPlatform)

Emitted when the primary lending platform is set.

Parameters:

Constants info

MODERATOR_ROLE (0x797669c9)

bytes32 constant MODERATOR_ROLE = keccak256("MODERATOR_ROLE")

State variables info

primaryLendingPlatform (0x92641a7c)

address primaryLendingPlatform

Modifiers info

onlyAdmin

modifier onlyAdmin()

Modifier to check if the caller has the DEFAULT_ADMIN_ROLE.

onlyPrimaryLendingPlatform

modifier onlyPrimaryLendingPlatform()

Modifier to restrict access to functions that can only be called by the primary lending platform.

Functions info

init (0x4703d19c)

function init(
    address underlying_,
    Bondtroller bondtroller_,
    InterestRateModel interestRateModel_,
    uint256 initialExchangeRateMantissa_,
    string memory name_,
    string memory symbol_,
    uint8 decimals_,
    address admin_
) public initializer

Initializes the bToken contract with the given parameters.

Parameters:

setPrimaryLendingPlatform (0xe801734a)

function setPrimaryLendingPlatform(
    address _primaryLendingPlatform
) public onlyAdmin

Sets the primary lending platform for the BLendingToken contract.

Parameters:

grantModerator (0x6981c7ae)

function grantModerator(address newModerator) public onlyAdmin

Grants the MODERATOR_ROLE to a new address.

Parameters:

revokeModerator (0x36445636)

function revokeModerator(address moderator) public onlyAdmin

Revokes the moderator role from the specified address.

Parameters:

transferAdminship (0x5be7cc16)

function transferAdminship(address payable newAdmin) public onlyAdmin

Transfers the adminship to a new address.

Parameters:

hasRoleModerator (0xd6526889)

function hasRoleModerator(address account) public view override returns (bool)

Returns true if the specified account has the moderator role.

Parameters:

Return values:

mintTo (0x449a52f8)

function mintTo(
    address minter,
    uint256 mintAmount
)
    external
    onlyPrimaryLendingPlatform
    returns (uint256 err, uint256 mintedAmount)

Mints new tokens to the specified minter address.

Parameters:

Return values:

redeemTo (0x2f7605fb)

function redeemTo(
    address redeemer,
    uint256 redeemTokens
) external onlyPrimaryLendingPlatform returns (uint256 redeemErr)

Redeems redeemTokens amount of bTokens for underlying assets to the redeemer address. Only the primary lending platform can call this function.

Parameters:

Return values:

redeemUnderlyingTo (0x6664aa78)

function redeemUnderlyingTo(
    address redeemer,
    uint256 redeemAmount
) external onlyPrimaryLendingPlatform returns (uint256 redeemUnderlyingError)

Redeems redeemAmount of bTokens for underlying asset and transfers them to redeemer. Only the primary lending platform can call this function.

Parameters:

Return values:

borrowTo (0xfda0241d)

function borrowTo(
    address borrower,
    uint256 borrowAmount
) external onlyPrimaryLendingPlatform returns (uint256 borrowError)

Allows the primary lending platform to borrow tokens on behalf of a borrower.

Parameters:

Return values:

repayTo (0x99c93213)

function repayTo(
    address payer,
    address borrower,
    uint256 repayAmount
)
    external
    onlyPrimaryLendingPlatform
    returns (uint256 repayBorrowError, uint256 amountRepaid)

Repays a specified amount of the calling user's borrow balance to a borrower. Only callable by the primary lending platform.

Parameters:

Return values:

getEstimatedBorrowIndex (0xcbebe597)

function getEstimatedBorrowIndex() public view returns (uint256)

Calculates the estimated borrow index based on the current borrow interest rate and the number of blocks elapsed since the last accrual.

Return values:

getEstimatedBorrowBalanceStored (0xb9ade142)

function getEstimatedBorrowBalanceStored(
    address account
) public view returns (uint256 accrual)

Returns the estimated borrow balance of an account based on the current borrow index.

Parameters:

Return values:

Last updated