Protocol Standard
VRC-20 Contract Standard
VRC-20 is a set of contract standards for the issuance of token assets, that is, contracts written in compliance with this standard are considered to be a VRC-20 contract. When various wallets and exchanges are docking the assets of the VRC-20 contract, from this set of contract standards, we can know which functions and events the contract defines, so as to facilitate the docking.
Optional
Token name
string public name = "VisionEuropeRewardCoin";
Token abbreviation
string public symbol = "VTK";
Token accuracy
uint8 public decimals = 6;
Required items
contract VRC20 {
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 method returns the total issuance of the token.
balanceOf(address _owner)
This method returns the token balance of the query account.
transfer(address _to, uint _value)
This method is used to transfer the token from the smart contract address to the specified account.
approve(address _spender, uint _value)
This method is used to authorize a third party (such as a DAPP contract) to transfer the token from the account of the token owner.
transferFrom(address _from, address _to, uint _value)
This method allows a third party to transfer the token from the account of the token owner. It needs to be used in conjunction with the approve() method.
allowance(address _owner, address _spender)
This method is used to query the balance of the token of the query account that can be transferred by a third party.
Event function
When the token is successfully transferred, the Transfer event will be triggered.
event Transfer(address indexed _from, address indexed _to, uint256 _value)
When the approve() method is successfully called, the Approval event will be triggered.
event Approval(address indexed _owner, address indexed _spender, uint256 _value)
Updated almost 3 years ago