Skip to main content

IGhoVariableDebtToken

Defines the basic interface of the GhoVariableDebtToken.

The IGhoVariableDebtToken interface inherits the IVariableDebtToken interface.

This page shows the events, write and view methods within the IGhoVariableDebtToken interface. The source code is available on GitHub.

Events

ATokenSet

event ATokenSet(address indexed aToken)

Emitted when the address of the GHO aToken is set.

Input Parameters:

NameTypeDescription
aTokenaddressThe address of the GhoAToken contract

DiscountRateStrategyUpdated

event DiscountRateStrategyUpdated(
address indexed oldDiscountRateStrategy,
address indexed newDiscountRateStrategy
)

Emitted when the discount rate strategy is updated.

Input Parameters:

NameTypeDescription
oldDiscountRateStrategyaddressThe address of the old GhoDiscountRateStrategy
newDiscountRateStrategyaddressThe address of the new GhoDiscountRateStrategy

DiscountTokenUpdated

event DiscountTokenUpdated(address indexed oldDiscountToken, address indexed newDiscountToken)

Emitted when the discount token is updated.

Input Parameters:

NameTypeDescription
oldDiscountTokenaddressThe address of the old discount token
newDiscountTokenaddressThe address of the new discount token

DiscountPercentUpdated

event DiscountPercentUpdated(
address indexed user,
uint256 oldDiscountPercent,
uint256 indexed newDiscountPercent
)

Emitted when the internal function _refreshDiscountPercent() is called, which updates the discount percent of the user according to current discount rate strategy.

Input Parameters:

NameTypeDescription
useraddressThe address of the user
oldDiscountPercentuint256The old discount percent of the user
newDiscountPercentuint256The new discount percent of the user

Write Methods

setAToken

function setAToken(address ghoAToken) external

Sets a reference to the GHO aToken.

Input Parameters:

NameTypeDescription
ghoATokenaddressThe address of the GhoAToken contract

updateDiscountRateStrategy

function updateDiscountRateStrategy(address newDiscountRateStrategy) external

Updates the Discount Rate Strategy.

Input Parameters:

NameTypeDescription
newDiscountRateStrategyaddressThe address of GhoDiscountRateStrategy contract

updateDiscountToken

function updateDiscountToken(address newDiscountToken) external

Updates the Discount Token.

Input Parameters:

NameTypeDescription
newDiscountTokenaddressThe address of DiscountToken contract

updateDiscountDistribution

function updateDiscountDistribution(
address sender,
address recipient,
uint256 senderDiscountTokenBalance,
uint256 recipientDiscountTokenBalance,
uint256 amount
) external

Updates the discount percents of the users when a discount token transfer occurs.

Input Parameters:

NameTypeDescription
senderaddressThe address of the sender
recipientaddressThe address of the recipient
senderDiscountTokenBalanceuint256The sender discount token balance
recipientDiscountTokenBalanceuint256The recipient discount token balance
amountuint256The amount of discount token being transferred

decreaseBalanceFromInterest

function decreaseBalanceFromInterest(address user, uint256 amount) external

Decrease the amount of interests accumulated by the user.

Input Parameters:

NameTypeDescription
useraddressThe address of the user
amountuint256The value to be decreased

rebalanceUserDiscountPercent

function rebalanceUserDiscountPercent(address user) external

Rebalances the discount percent of a user.

Input Parameters:

NameTypeDescription
useraddressThe address of the user

View Methods

getAToken

function getAToken() external view returns (address)

Returns the address of the GHO aToken.

Return Values:

TypeDescription
addressThe address of the GhoAToken contract

getDiscountRateStrategy

function getDiscountRateStrategy() external view returns (address)

Returns the address of the Discount Rate Strategy.

Return Values:

TypeDescription
addressThe address of GhoDiscountRateStrategy contract

getDiscountToken

function getDiscountToken() external view returns (address)

Returns the address of the Discount Token.

Return Values:

TypeDescription
addressThe address of DiscountToken

getDiscountPercent

function getDiscountPercent(address user) external view returns (uint256)

Returns the discount percent being applied to the debt interest of the user.

Input Parameters:

NameTypeDescription
useraddressThe address of the user

Return Values:

TypeDescription
uint256The discount percent (expressed in bps)

getBalanceFromInterest

function getBalanceFromInterest(address user) external view returns (uint256)

Returns the amount of interests accumulated by the user.

Input Parameters:

NameTypeDescription
useraddressThe address of the user

Return Values:

TypeDescription
uint256The amount of interests accumulated by the user