IAchievement

Git Source

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

NameTypeDescription
name_stringThe name of the token.
symbol_stringThe symbol of the token.
admin_addressThe account to be granted with APP_ADMIN_ROLE.
powerToken_addressThe 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

NameTypeDescription
namestringName of the achievement.
descriptionstringDescription of the achievement.
imageURLstringImage URL of the achievement.

mint

Mints a token to account.

function mint(string calldata achievement) external returns (uint256 tokenId);

Parameters

NameTypeDescription
achievementstringName of the achievement to mint.

Returns

NameTypeDescription
tokenIduint256The new minted token id.

totalSupply

Returns total supply of tokens.

function totalSupply() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256Total supply of tokens.

getAllAchievements

Returns the achievement details of all achievements.

function getAllAchievements() external view returns (AchievementDetails[] memory);

Returns

NameTypeDescription
<none>AchievementDetails[]Achievement details.

hasAchievement

Returns whether the account has the achievement.

function hasAchievement(address account, string calldata achievementName)
    external
    view
    returns (bool);

Parameters

NameTypeDescription
accountaddressThe address of the account.
achievementNamestringThe name of the achievement.

Returns

NameTypeDescription
<none>boolWhether the account has the achievement.

powerToken

Returns the address of the PowerToken contract.

function powerToken() external view returns (address);

Returns

NameTypeDescription
<none>addressAddress of the PowerToken contract.