Skip to content
This repository has been archived by the owner on Sep 8, 2023. It is now read-only.

Token Database

Norton Wang edited this page Sep 7, 2021 · 1 revision

Goal

A canister that acts as the global database of all known tokens, fungible and non-fungible. A developer can query for this list, then query each of them individually for user balances.

Specification

public type Data = {
  canister: Principal; // token ledger canister
  id: ?Text; // optional ID, needs to support all widely used standards
  name: Text; // eg. "ICPunks" or "XTC"
};

public type InternalId = Nat;

public type TokenDatabase = actor {
  // Public: Retrieve all data
  get : shared () -> async [Data];

  // Permissioned:
  // Add a datum
  add : shared (Data) -> async ();

  // Delete data by id
  remove : shared ([InternalId]) -> async ();
};

Notes

  • Who is allowed to add to this database?
Clone this wiki locally