/motoko-token

The Token Package

Primary LanguageModelicaApache License 2.0Apache-2.0

The Token Package

Build Status

This package implements a simple ERC-20 style token.

Prerequisites

Usage

Return the name of the token.

public query func name() : async Text

Return the symbol of the token.

public query func symbol() : async Text

Return the total token supply.

public query func totalSupply() : async Nat

Return the token balance of a token owner.

public query func balanceOf(owner : Owner) : async ?Nat

Transfer tokens to another token owner.

public shared func transfer(to : Owner, amount : Nat) : async Bool

Allows spender to spend amount tokens from function caller

public shared func approve(spender : Owner, amount : Nat) async Bool

Returns the amount of tokens that spender can spend from owner

public query func allowance(owner : Owner, spender : Owner) async Nat

Transfer amount tokens from owner to to. Function caller should have permission to do so. See function approve.

public shared func transferFrom(owner : Owner, to : Owner, amount : Nat) async Bool