Skip to main content

GhoAToken

The implementation of the interest bearing token for the Aave Protocol.

info

GHO cannot be supplied to the Aave Protocol. However, the GhoAToken is required as it contains logic for GHO to work as a reserve with the Aave Protocol.

The GhoAToken contract inherits the VersionedInitializable, ScaledBalanceTokenBase and EIP712Base contracts, and the IGhoAToken interface.

This page shows the public constant state variables, external write and view methods, and the 'not permitted methods' within the GhoAToken contract. The source code is available on GitHub.

Constant State Variables

The external state variables.

PERMIT_TYPEHASH

bytes32 public constant PERMIT_TYPEHASH =
keccak256('Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)')

ATOKEN_REVISION

uint256 public constant ATOKEN_REVISION = 0x1

Write Methods

initialize

function initialize(
IPool initializingPool,
address treasury,
address underlyingAsset,
IAaveIncentivesController incentivesController,
uint8 aTokenDecimals,
string calldata aTokenName,
string calldata aTokenSymbol,
bytes calldata params
) external override initializer

Initializes the aToken.

Emits the Initialized event.

Input Parameters:

NameTypeDescription
initializingPoolIPoolThe pool contract that is initializing this contract
treasuryaddressThe address of the Aave treasury, receiving the fees on this aToken
underlyingAssetaddressThe address of the underlying asset of this aToken, GHO
incentivesControllerIAaveIncentivesControllerThe smart contract managing potential incentives distribution
aTokenDecimalsuint8The decimals of the aToken, same as the underlying asset’s, 18
aTokenNamestringThe name of the aToken, ghoAToken
aTokenSymbolstringThe symbol of the aToken, GHO
paramsbytesA set of encoded parameters for additional initialization

transferUnderlyingTo

function transferUnderlyingTo(address target, uint256 amount) external virtual override onlyPool

Transfers the underlying asset to target.

It performs a mint of GHO on behalf of the target. Used by the Pool to transfer assets in borrow().

Input Parameters:

NameTypeDescription
targetaddressThe recipient of the underlying token
amountuint256The amount getting transferred

handleRepayment

function handleRepayment(
address user,
address onBehalfOf,
uint256 amount
) external virtual override onlyPool

Handles the underlying received by the aToken after the transfer has been completed.

This function transfers the debt interest repaid by a user to the GHO treasury. It burns all the repaid GHO.

Input Parameters:

NameTypeDescription
useraddressThe user executing the repayment
onBehalfOfaddressThe address of the user who will get their debt reduced/removed.
amountuint256The amount getting repaid

distributeFeesToTreasury

function distributeFeesToTreasury() external virtual override

Distribute accumulated fees to the GHO treasury.

Emits the FeesDistributedToTreasury event.

rescueTokens

function rescueTokens(address token, address to, uint256 amount) external override onlyPoolAdmin

Rescues and transfers the tokens locked in this contract to the recipient.

The underlying asset, GHO, cannot be rescued.

Input Parameters:

NameTypeDescription
tokenaddressThe address of the token
toaddressThe address of the recipient
amountuint256The amount of token to transfer

setVariableDebtToken

function setVariableDebtToken(address ghoVariableDebtToken) external override onlyPoolAdmin

Sets a reference to the GHO variable debt token. The variable debt token must not already be set.

Emits the VariableDebtTokenSet event.

Input Parameters:

NameTypeDescription
ghoVariableDebtTokenaddress The address of the GHOVariableDebtToken

updateGhoTreasury

function updateGhoTreasury(address newGhoTreasury) external override onlyPoolAdmin

Updates the address of the GHO treasury, where interest earned by the protocol is sent.

Emits the GhoTreasuryUpdated event.

Input Parameters:

NameTypeDescription
newGhoTreasuryaddressThe address of the GhoTreasury

View Methods

The balanceOf and totalSupply methods, both return zero. The reason is that GHO cannot be supplied to the Aave Protocol. However, the GhoAToken is required as it contains logic for GHO to work as a reserve with the Aave Protocol.

balanceOf

function balanceOf(
address user
) public view virtual override(IncentivizedERC20, IERC20) returns (uint256)

Returns zero at GhoAToken.

Standard ERC20 method.

Input Parameters:

NameTypeDescription
useraddressThe address of the user

Return Values:

TypeDescription
uint2560

totalSupply

function totalSupply() public view virtual override(IncentivizedERC20, IERC20) returns (uint256)

Returns zero at GhoAToken.

Standard ERC20 method.

Return Values:

TypeDescription
uint2560

RESERVE_TREASURY_ADDRESS

function RESERVE_TREASURY_ADDRESS() external view override returns (address)

Returns the address of the Aave treasury.

Return Values:

TypeDescription
addressThe address of the Aave treasury

UNDERLYING_ASSET_ADDRESS

function UNDERLYING_ASSET_ADDRESS() external view override returns (address)

Returns the address of GHO as it is the underlying asset of this aToken.

Return Values:

TypeDescription
addressThe address of the underlying asset, GHO

DOMAIN_SEPARATOR

function DOMAIN_SEPARATOR() public view override(IAToken, EIP712Base) returns (bytes32)

Overrides the base function to fully implement IAToken.

Gets the domain separator for the token. Return cached value if chainId matches cache, otherwise recomputes separator.

See EIP712Base.DOMAIN_SEPARATOR() for more detailed documentation.

Return Values:

TypeDescription
bytes32The domain separator of the token on the current chain

nonces

function nonces(address owner) public view override(IAToken, EIP712Base) returns (uint256)

Overrides the base function to fully implement IAToken.

Returns the nonce of the owner.

See EIP712Base.nonces() for more detailed documentation.

Input Parameters:

NameTypeDescription
owneraddressThe address of the owner

Return Values:

TypeDescription
uint256The nonce of the owner

getVariableDebtToken

function getVariableDebtToken() external view override returns (address)

Returns the address of the GHO variable debt token.

Return Values:

TypeDescription
addressThe address of the GhoVariableDebtToken contract

getGhoTreasury

function getGhoTreasury() external view override returns (address) {

Returns the address of the GHO treasury.

Return Values:

TypeDescription
addressThe address of the GhoTreasury contract

NOT PERMITTED METHODS

The following methods automatically revert with the error from Aave V3 OPERATION_NOT_SUPPORTED as they are not permitted to be executed.

For example, mint() is not permitted as it is not possible to supply GHO into the pool.

mint

function mint(
address caller,
address onBehalfOf,
uint256 amount,
uint256 index
) external virtual override onlyPool returns (bool)

Not permitted by design.

burn

function burn(
address from,
address receiverOfUnderlying,
uint256 amount,
uint256 index
) external virtual override onlyPool

Not permitted by design.

mintToTreasury

function mintToTreasury(uint256 amount, uint256 index) external virtual override onlyPool

Not permitted by design.

transferOnLiquidation

function transferOnLiquidation(
address from,
address to,
uint256 value
) external virtual override onlyPool

Not permitted by design.

permit

function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external

Not permitted by design.