IAchievement
Functions
initialize
Initializes the contract. Setup token name, symbol and account with APP_ADMIN_ROLE.
function initialize(
string calldata name_,
string calldata symbol_,
address admin_,
address powerToken_
) external;
Parameters
Name | Type | Description |
---|---|---|
name_ | string | The name of the token. |
symbol_ | string | The symbol of the token. |
admin_ | address | The account to be granted with APP_ADMIN_ROLE. |
powerToken_ | address | The address of the power token. |
setAchievement
Only the APP_ADMIN_ROLE can set the achievement details.
function setAchievement(string calldata name, string calldata description, string calldata imageURL)
external;
Parameters
Name | Type | Description |
---|---|---|
name | string | Name of the achievement. |
description | string | Description of the achievement. |
imageURL | string | Image URL of the achievement. |
mint
Mints a token to account
.
function mint(string calldata achievement) external returns (uint256 tokenId);
Parameters
Name | Type | Description |
---|---|---|
achievement | string | Name of the achievement to mint. |
Returns
Name | Type | Description |
---|---|---|
tokenId | uint256 | The new minted token id. |
totalSupply
Returns total supply of tokens.
function totalSupply() external view returns (uint256);
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | Total supply of tokens. |
getAllAchievements
Returns the achievement details of all achievements.
function getAllAchievements() external view returns (AchievementDetails[] memory);
Returns
Name | Type | Description |
---|---|---|
<none> | AchievementDetails[] | Achievement details. |
hasAchievement
Returns whether the account has the achievement.
function hasAchievement(address account, string calldata achievementName)
external
view
returns (bool);
Parameters
Name | Type | Description |
---|---|---|
account | address | The address of the account. |
achievementName | string | The name of the achievement. |
Returns
Name | Type | Description |
---|---|---|
<none> | bool | Whether the account has the achievement. |
powerToken
Returns the address of the PowerToken contract.
function powerToken() external view returns (address);
Returns
Name | Type | Description |
---|---|---|
<none> | address | Address of the PowerToken contract. |