IStableDebtToken

Git Source

Author: Aave

Defines the interface for the stable debt token

Functions

mint

Mints debt token to the onBehalfOf address.

The resulting rate is the weighted average between the rate of the new debt and the rate of the previous debt

function mint(address user, address onBehalfOf, uint256 amount, uint256 rate)
    external
    returns (bool, uint256, uint256);

Parameters

NameTypeDescription
useraddressThe address receiving the borrowed underlying, being the delegatee in case of credit delegate, or same as onBehalfOf otherwise
onBehalfOfaddressThe address receiving the debt tokens
amountuint256The amount of debt tokens to mint
rateuint256The rate of the debt being minted

Returns

NameTypeDescription
<none>boolTrue if it is the first borrow, false otherwise
<none>uint256The total stable debt
<none>uint256The average stable borrow rate

burn

Burns debt of user

The resulting rate is the weighted average between the rate of the new debt and the rate of the previous debt

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

function burn(address from, uint256 amount) external returns (uint256, uint256);

Parameters

NameTypeDescription
fromaddressThe address from which the debt will be burned
amountuint256The amount of debt tokens getting burned

Returns

NameTypeDescription
<none>uint256The total stable debt
<none>uint256The average stable borrow rate

getAverageStableRate

Returns the average rate of all the stable rate loans.

function getAverageStableRate() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256The average stable rate

getUserStableRate

Returns the stable rate of the user debt

function getUserStableRate(address user) external view returns (uint256);

Parameters

NameTypeDescription
useraddressThe address of the user

Returns

NameTypeDescription
<none>uint256The stable rate of the user

getUserLastUpdated

Returns the timestamp of the last update of the user

function getUserLastUpdated(address user) external view returns (uint40);

Parameters

NameTypeDescription
useraddressThe address of the user

Returns

NameTypeDescription
<none>uint40The timestamp

getSupplyData

Returns the principal, the total supply, the average stable rate and the timestamp for the last update

function getSupplyData() external view returns (uint256, uint256, uint256, uint40);

Returns

NameTypeDescription
<none>uint256The principal
<none>uint256The total supply
<none>uint256The average stable rate
<none>uint40The timestamp of the last update

getTotalSupplyLastUpdated

Returns the timestamp of the last update of the total supply

function getTotalSupplyLastUpdated() external view returns (uint40);

Returns

NameTypeDescription
<none>uint40The timestamp

getTotalSupplyAndAvgRate

Returns the total supply and the average stable rate

function getTotalSupplyAndAvgRate() external view returns (uint256, uint256);

Returns

NameTypeDescription
<none>uint256The total supply
<none>uint256The average rate

principalBalanceOf

Returns the principal debt balance of the user

function principalBalanceOf(address user) external view returns (uint256);

Returns

NameTypeDescription
<none>uint256The debt balance of the user since the last burn/mint action

UNDERLYING_ASSET_ADDRESS

Returns the address of the underlying asset of this stableDebtToken (E.g. WETH for stableDebtWETH)

function UNDERLYING_ASSET_ADDRESS() external view returns (address);

Returns

NameTypeDescription
<none>addressThe address of the underlying asset

Events

Mint

Emitted when new stable debt is minted

event Mint(
    address indexed user,
    address indexed onBehalfOf,
    uint256 amount,
    uint256 currentBalance,
    uint256 balanceIncrease,
    uint256 newRate,
    uint256 avgStableRate,
    uint256 newTotalSupply
);

Burn

Emitted when new stable debt is burned

event Burn(
    address indexed from,
    uint256 amount,
    uint256 currentBalance,
    uint256 balanceIncrease,
    uint256 avgStableRate,
    uint256 newTotalSupply
);