IPowerToken

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_,
    uint256 dailyMintLimit_
) 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.
dailyMintLimit_uint256The token limit for daily mint.

setDailyMintLimit

Sets the token limit for daily mint.

The caller must have the APP_ADMIN_ROLE.

function setDailyMintLimit(uint256 limit) external;

Parameters

NameTypeDescription
limituint256The new limit to set.

mintToTreasury

Mints tokens to the treasury.

The caller must have the APP_ADMIN_ROLE.

function mintToTreasury(address treasuryAdmin, uint256 amount) external;

Parameters

NameTypeDescription
treasuryAdminaddressThe account to receive the tokens.
amountuint256The amount of tokens to mint.

mint

Issues new token points.

The caller must have the APP_ADMIN_ROLE.

function mint(address to, uint256 amount, uint256 taxBasisPoints) external;

Parameters

NameTypeDescription
toaddressThe account to receive the token points.
amountuint256The amount of token points to mint.
taxBasisPointsuint256The tax basis points.

dailyMint

Issues new token points to caller.

The caller must have the APP_USER_ROLE.

function dailyMint(uint256 amount, uint256 taxBasisPoints) external;

Parameters

NameTypeDescription
amountuint256The amount of token points to mint.
taxBasisPointsuint256The tax basis points.

airdrop

Airdrops tokens to the users.

The caller must have the APP_ADMIN_ROLE.

function airdrop(address to, uint256 amount, uint256 taxBasisPoints) external;

Parameters

NameTypeDescription
toaddressThe account to receive the tokens.
amountuint256The amount of tokens to mint.
taxBasisPointsuint256The tax basis points.

purchase

Purchases with token points. If token points are not enough, it will try the balance.

The to and feedId are optional, but at least one of them must be provided. If both are provided, the to will be used.

function purchase(uint256 amount, address to, bytes32 feedId, uint256 taxBasisPoints) external;

Parameters

NameTypeDescription
amountuint256The amount of token points to send.
toaddressThe address to send the token points. It can be empty.
feedIdbytes32The feed id. It can be empty.
taxBasisPointsuint256The tax basis points.

tip

Tips with token points. If token points are not enough, it will try the balance.

The to and feedId are optional, but at least one of them must be provided. If both are provided, the to will be used.

function tip(uint256 amount, address to, bytes32 feedId, uint256 taxBasisPoints) external;

Parameters

NameTypeDescription
amountuint256The amount of token points to send.
toaddressThe address to send the token points. It can be empty.
feedIdbytes32The feed id. It can be empty.
taxBasisPointsuint256The tax basis points.

withdrawByFeedId

Withdraws tokens by feedId. to is supposed to be the true owner of the feedId.

The caller must have the APP_ADMIN_ROLE.

function withdrawByFeedId(address to, bytes32 feedId) external;

Parameters

NameTypeDescription
toaddressThe address who receives the tokens.
feedIdbytes32The amount belongs to the feedId.

addUser

Grants the APP_USER_ROLE to the specified account and send native tokens to it.

The caller must have the APP_ADMIN_ROLE.

function addUser(address account) external payable;

Parameters

NameTypeDescription
accountaddressThe address to grant the role.

addUsers

Grants the APP_USER_ROLE to the specified accounts.

The caller must have the APP_ADMIN_ROLE.

function addUsers(address[] calldata accounts) external payable;

Parameters

NameTypeDescription
accountsaddress[]The addresses to grant the role.

removeUser

Revokes the APP_USER_ROLE from the specified account.

The caller must have the APP_ADMIN_ROLE.

function removeUser(address account) external;

Parameters

NameTypeDescription
accountaddressThe address from which to revoke the role.

balanceOfByFeed

Return the balance of the feedId

function balanceOfByFeed(bytes32 feedId) external view returns (uint256);

Parameters

NameTypeDescription
feedIdbytes32The feed id

Returns

NameTypeDescription
<none>uint256The amount of the balance

balanceOfPoints

Return the balance of points, aka the inactive tokens, of the owner

function balanceOfPoints(address owner) external view returns (uint256);

Parameters

NameTypeDescription
owneraddressThe address of the owner

Returns

NameTypeDescription
<none>uint256The amount of the balance

getDailyMintLimit

Returns the token limit for daily mint.

function getDailyMintLimit() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256The token limit for daily mint.