VariableDebtToken

Implements a variable debt token to track the borrowing positions of users at variable rate mode

Transfer and approve functionalities are disabled since its a non-transferable token

DEBT_TOKEN_REVISION

uint256 DEBT_TOKEN_REVISION

constructor

constructor(contract IPool pool) public

Constructor.

Parameters

NameTypeDescription

pool

contract IPool

The address of the Pool contract

initialize

function initialize(contract IPool initializingPool, address underlyingAsset, contract IRewardController incentivesController, uint8 debtTokenDecimals, string debtTokenName, string debtTokenSymbol, bytes params) external

Initializes the debt token.

Parameters

NameTypeDescription

initializingPool

contract IPool

underlyingAsset

address

The address of the underlying asset of this xToken (E.g. WETH for pWETH)

incentivesController

contract IRewardController

The smart contract managing potential incentives distribution

debtTokenDecimals

uint8

The decimals of the debtToken, same as the underlying asset's

debtTokenName

string

The name of the token

debtTokenSymbol

string

The symbol of the token

params

bytes

A set of encoded parameters for additional initialization

getRevision

function getRevision() internal pure virtual returns (uint256)

Returns the revision number of the contract

Needs to be defined in the inherited class as a constant.

Return Values

NameTypeDescription

[0]

uint256

The revision number

balanceOf

function balanceOf(address user) public view virtual returns (uint256)

mint

function mint(address user, address onBehalfOf, uint256 amount, uint256 index) external virtual returns (bool, uint256)

Mints debt token to the onBehalfOf address

Parameters

NameTypeDescription

user

address

The address receiving the borrowed underlying, being the delegatee in case of credit delegate, or same as onBehalfOf otherwise

onBehalfOf

address

The address receiving the debt tokens

amount

uint256

The amount of debt being minted

index

uint256

The variable debt index of the reserve

Return Values

NameTypeDescription

[0]

bool

True if the previous balance of the user is 0, false otherwise

[1]

uint256

The scaled total debt of the reserve

burn

function burn(address from, uint256 amount, uint256 index) external virtual returns (uint256)

Burns user variable debt

In some instances, a burn transaction will emit a mint event if the amount to burn is less than the interest that the user accrued

Parameters

NameTypeDescription

from

address

The address from which the debt will be burned

amount

uint256

The amount getting burned

index

uint256

The variable debt index of the reserve

Return Values

NameTypeDescription

[0]

uint256

The scaled total debt of the reserve

totalSupply

function totalSupply() public view virtual returns (uint256)

_EIP712BaseId

function _EIP712BaseId() internal view returns (string)

Returns the user readable name of signing domain (e.g. token name)

Return Values

NameTypeDescription

[0]

string

The name of the signing domain

transfer

function transfer(address, uint256) external virtual returns (bool)

Being non transferrable, the debt token does not implement any of the standard ERC20 functions for transfer and allowance.

allowance

function allowance(address, address) external view virtual returns (uint256)

approve

function approve(address, uint256) external virtual returns (bool)

transferFrom

function transferFrom(address, address, uint256) external virtual returns (bool)

increaseAllowance

function increaseAllowance(address, uint256) external virtual returns (bool)

decreaseAllowance

function decreaseAllowance(address, uint256) external virtual returns (bool)

UNDERLYING_ASSET_ADDRESS

function UNDERLYING_ASSET_ADDRESS() external view returns (address)

Returns the address of the underlying asset of this debtToken (E.g. WETH for variableDebtWETH)

Return Values

NameTypeDescription

[0]

address

The address of the underlying asset