Token-Standard

Check standards source code here.

Why do we need a token standard? Simple because everything is a smart contract, your favorite token in this protocol is just your balance stored somewhere, I mean what else is money anyway. And to make a common interface for every smart contract which should behave like a token we use a token-standard. Like ERC-20 for example in Ethereum.

This means any contract which implements the necessary function is at the bare minimum a token. There can be more functionality on top, or some clever ways to implement the functions. The main thing, though, is that every dapp existing now or in the future can interact with your token / contract. To give a proper example: the AMM currently available operates with this standard in mind, therefore every token you create which has the token-standard functions, can be swapped at the AMM.

LRC-20

Mutations

transfer(to: string, value: number) this function transfers from the sender to the to the amount of value. It should check to see if the sender has enough balance.

approve(spender: string, value: number) allows the spender to transfer the token out of the senders wallet with the transferFrom function

Queries

name() returns string the name of the token

symbol() returns string the symbol of the token

decimals() returns number the number of decimals, because we only use integer values internally to prevent rounding errors

totalSupply() returns number the current supply of tokens

balanceOf(owner: string) returns number the balance of the owner

allowance(owner: string, spender: string) returns number the allowance set by the owner for the spender

Events

Transfer(from, to, value) logged when a transfer happened

Approval(owner, spender, value) logged when an approval happened

LRC-721

TBA

Last updated