Token Smart Contract

The code below is an example and requires further refinement for specific business tasks.

Interface BasicStandard is necessary to create a token (implementation is mandatory and provided below).

public interface BasicStandard {

   String getName();

   String getSymbol();

   int getDecimal();

   boolean setFrozen(boolean frozen);

   String totalSupply();

   String balanceOf(String owner);

   String allowance(String owner, String spender);

   boolean transfer(String to, String amount);

   boolean transferFrom(String from, String to, String amount);

   void approve(String spender, String amount);

   boolean burn(String amount);

}

As well as interface ExtensionStandard (Implementation is not mandatory, but recommended and is provided below).

Further is the example of a token implementation according to SWT standard.

Examples sets the following in the class constructor:

  • Token name (name)

  • Token symbol (symbol)

  • Number of decimals (decimal)

  • Public key of the token owner (owner)

  • Total number of tokens (totalCoins)

Examples of implementation of Interfaces BasicStandard and ExtensionsStandard are provided below.

Last updated