Skip to main content

GhoToken

The GhoToken contract inherits the ERC20 and AccessControl contracts, and the IGhoToken interface.

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

Constant State Variables

FACILITATOR_MANAGER_ROLE

bytes32 public constant FACILITATOR_MANAGER_ROLE = keccak256('FACILITATOR_MANAGER_ROLE')

BUCKET_MANAGER_ROLE

bytes32 public constant BUCKET_MANAGER_ROLE = keccak256('BUCKET_MANAGER_ROLE')

Write Methods

mint

function mint(address account, uint256 amount) external override

Mints the requested amount of tokens to the account address.

Only Facilitators with enough bucket capacity available can mint. The bucket level increases upon minting (newBucketLevel = currentBucketLevel + amount), and must be less than or equal to the bucket capacity.

Emits the FacilitatorBucketLevelUpdated event. To track all Facilitator activity, follow this event.

Input Parameters:

NameTypeDescription
accountaddressThe address receiving the GHO tokens
amountuint256The amount to mint

burn

function burn(uint256 amount) external override

Burns the requested amount of tokens from the account address.

The amount of tokens to burn must be greater than 0.

Only active Facilitators (bucket level > 0) can burn. The bucket level decreases upon burning (newBucketLevel = currentBucketLevel - amount).

Emits the FacilitatorBucketLevelUpdated event.

Input Parameters:

NameTypeDescription
amountuint256The amount to burn

addFacilitator

function addFacilitator(
address facilitatorAddress,
string calldata facilitatorLabel,
uint128 bucketCapacity
) external onlyRole(FACILITATOR_MANAGER)

Add the Facilitator passed with the parameters to the Facilitators list.

Emits the FacilitatorAdded event.

Input Parameters:

NameTypeDescription
facilitatorAddressaddressThe address of the Facilitators to add
facilitatorLabelstringA human readable identifier for the facilitator
bucketCapacityuint128The upward limit of GHO can be minted by the facilitator

removeFacilitator

function removeFacilitator(address facilitatorAddress) external onlyRole(FACILITATOR_MANAGER_ROLE)

Remove the Facilitator from the Facilitators list.

The Facilitator must exist as a current Facilitator, and must have a bucketLevel equal to 0.

Emits the FacilitatorRemoved event.

Input Parameters:

NameTypeDescription
facilitatorAddressaddressThe address of the Facilitators to remove

setFacilitatorBucketCapacity

function setFacilitatorBucketCapacity(
address facilitator,
uint128 newCapacity
) external onlyRole(BUCKET_MANAGER_ROLE)

Sets the bucket capacity for the facilitator.

The owner of the contract is able to increase/decrease the bucket capacity for the given facilitator.

Emits the FacilitatorBucketCapacityUpdated event.

Input Parameters:

NameTypeDescription
facilitatoraddressThe address of the Facilitator
newCapacityuint128The new capacity of the bucket

View Methods

getFacilitator

function getFacilitator(address facilitator) external view returns (Facilitator memory)

Returns the facilitator data.

Input Parameters:

NameTypeDescription
facilitatoraddressThe address of the Facilitator

Return Values:

TypeDescription
FacilitatorThe Facilitator configuration

The Facilitator struct is composed of the following fields:

NameTypeDescription
capacityuint128The capacity of the bucket assigned to a specific Facilitator
leveluint128The bucket level
labelstringThe label of the Facilitator bucket

getFacilitatorBucket

function getFacilitatorBucket(address facilitator) external view returns (uint256, uint256)

Returns the facilitator bucket configuration.

Input Parameters:

NameTypeDescription
facilitatoraddressThe address of the Facilitator

Return Values:

TypeDescription
uint128The capacity of the Facilitator’s bucket
uint128The level of the Facilitator’s bucket

getFacilitatorsList

function getFacilitatorsList() external view returns (address[] memory)

Returns the list of addresses of the active Facilitators.

Return Values:

TypeDescription
address[]The list of the Facilitators addresses