Skip to content
forked from NatLabs/icrc1

A full implementation of the ICRC-1 fungible token standard

License

Notifications You must be signed in to change notification settings

Overchute/icrc1

 
 

Repository files navigation

ICRC-1 Implementation

This repo contains the implementation of the ICRC-1 token standard.

References and other implementations

Documentation

Getting Started

  • Expose the ICRC-1 token functions from your canister

    • Import the icrc1 lib and expose them in an actor class.

      Take a look at the examples

  • Launch the basic token with all the standard functions for ICRC-1

    • Install the mops package manager
    • Replace the values enclosed in < > with your desired values and run in the terminal
      git clone https://github.com/NatLabs/icrc1
      cd icrc1
      mops install
      dfx start --background --clean
    
      dfx deploy icrc1 --argument "( record {\
          name = \"<Insert Token Name>\"; \
          symbol = \"<Insert Symbol>\"; \
          decimals = <Insert Decimal>; \
          fee = <Insert Fee>; \
          max_supply = <Insert Max Supply>; \
          initial_balances = vec {}; \
          minting_account = null; \
          permitted_drift = null; \
          transaction_window = null; \
      })"
  • Create a token dynamically from a canister

        import Nat8 "mo:base/Nat8";
        import Token "mo:icrc1/ICRC1/Canisters/Token";
    
        actor{
            let decimals = 8; // replace with your chosen number of decimals
    
            func add_decimals(n: Nat): Nat{
                n * 10 ** decimals
            };
    
            let token_canister = Token.Token({
                name = "<Insert Token Name>";
                symbol = "<Insert Token Symbol>";
                decimals = Nat8.fromNat(decimals);
                fee = add_decimals(1);
                max_supply = add_decimals(1_000_000);
                initial_balances = [];
                minting_account = null; // defaults to the caller
                permitted_drift = null; // defaults to one hour
                transaction_window = null; // defaults to a day
            });
        }

Tests

  • Download and Install vessel
  • Run make test
  • Run make actor-test

About

A full implementation of the ICRC-1 fungible token standard

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Motoko 98.2%
  • Dhall 1.4%
  • Makefile 0.4%