Difference between revisions of "What are TRC20 tokens"

From CoinWiki
Jump to: navigation, search
 
Line 35: Line 35:
  
 
<code>event Approval(address indexed tokenOwner, address indexed spender, uint tokens);</code>
 
<code>event Approval(address indexed tokenOwner, address indexed spender, uint tokens);</code>
 +
 +
== See Also ==
 +
* [[TRC10]]
 +
* [[ERC20]]
 +
* [[Tron]]
  
 
== References ==
 
== References ==
 
<references/>
 
<references/>

Latest revision as of 19:51, 9 January 2019

The TRC20 token is a smart contract standard on the Tron blockchain. The TRC20 standard allows for more customization when compared with the TRC10 standard. It is comparable to the Ethereum ERC20 token standard. Since the the token is build off Solidity just like the ERC20[1], it is fully compatible with Ethereum's smart contracts.

Token Functions

Since the TRC20 is based off of ERC20, they have the same functions as shown below.

  • Get the total token supply:

function totalSupply() public constant returns (uint);

  • Get the account balance of another account:

function balanceOf(address tokenOwner) public constant returns (uint balance);

  • Returns the amount which the spender is still allowed to withdraw from the owner:

function allowance(address tokenOwner, address spender) public constant returns (uint remaining);

  • Send amount of tokens to address:

function transfer(address to, uint tokens) public returns (bool success);

  • Allow spender to withdraw from your account, multiple times, up to the amount written. If this function is called again it overwrites the current allowance with the value:

function approve(address spender, uint tokens) public returns (bool success);

  • Send amount of tokens from one address to another address:

function transferFrom(address from, address to, uint tokens) public returns (bool success);

  • Triggered when tokens are transferred

event Transfer(address indexed from, address indexed to, uint tokens);

  • Triggered whenever approve is called:

event Approval(address indexed tokenOwner, address indexed spender, uint tokens);

See Also

References