Protocol Interface
PRC-20 contract standard
PRC-20 is a set of contract standards for the issuance of token assets. Contracts written in compliance with this standard are considered to be a PRC-20 contract. When wallets and exchanges are integrating the assets of the PRC-20 contract, they can refer to this set of standards to understand the functions and events defined by the contract, facilitating the integration process.
Optional
Token Name
string public name = "PolluxRewardToken";
Token Abbreviation
string public symbol = "PRT";
Token Precision(Decimals)
uint8 public decimals = 6;
Required Items
contract PRC20 {
function totalSupply() constant returns (uint theTotalSupply);
function balanceOf(address _owner) constant returns (uint balance);
function transfer(address _to, uint _value) returns (bool success);
function transferFrom(address _from, address _to, uint _value) returns (bool success);
function approve(address _spender, uint _value) returns (bool success);
function allowance(address _owner, address _spender) constant returns (uint remaining);
event Transfer(address indexed _from, address indexed _to, uint _value);
event Approval(address indexed _owner, address indexed _spender, uint _value);
}
totalSupply() This function retrieves the total supply of the token.
balanceOf() This function retrieves the token balance of a specific account.
transfer() This function facilitates the transfer of a specified number of tokens to a designated address.
approve() This function authorizes a third party, such as a DAPP smart contract, to transfer tokens from the owner's account.
transferFrom() This function permits the third party to transfer tokens from an owner account to a recipient account, provided the owner account has been approved by the third party.
allowance() This function queries the remaining amount of tokens that the third party can transfer.
Event Functions
When the token is successfully transferred, the contract will initiate a Transfer Event.
event Transfer(address indexed _from, address indexed _to, uint256 _value);
When the approval() function is successfully invoked, the contract will trigger an Approval Event.
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
Last updated