♾️ INFINIT CLI Alpha release is now available!
API References
@infinit-xyz/token

Token Module

Config

  • protocol_module = token

Registry

The available fields in the Token module to use in the infinit.registry.json are as follows:

FieldTypeDescription
tokensobject<string ,{ type: 'InfinitERC20' | 'InfinitERC20Burnable' }>Mapping of token addresses to TokenType.
tokenDistributorsstring[]List of token distributor addresses.
accumulativeMerkleDistributorsobject<string ,{ implementation: string }Mapping of addresses to proxies for accumulative Merkle distributors.
merkleTreeMerkleTreeMerkle tree data.

MerkleTree

FieldTypeDescription
rootstringRoot hash of the Merkle tree.
merkleobject<string, { amount: string; proof: string[] }>Mapping of addresses to Merkle proofs and amounts.

Actions

The actions available in the @infinit-xyz/token/actions are as follows:

import {
	DeployInfinitERC20Action, 
	DeployInfinitERC20BurnableAction,
	SetMerkleRootAction
} from '@infinit-xyz/token/actions'

DeployInfinitERC20Action

DeployInfinitERC20Action is an action that deploys a pure ERC20 token.

Parameters

FieldTypeRequiredDescription
ownerAddressYesToken owner
namestringYesToken name
symbolstringYesToken symbol
maxSupplyBigInt (opens in a new tab)YesToken max supply
initialSupplyBigInt (opens in a new tab)YesToken mint amount when deployed

Signers

  • deployer: Deployer of the token will be assigned as the owner of the token.

DeployInfinitERC20BurnableAction

DeployInfinitERC20BurnableAction is an action that deploys a burnable ERC20 token.

Parameters

FieldTypeRequiredDescription
ownerAddressYesToken owner address string
namestringYesToken name
symbolstringYesToken symbol
maxSupplyBigInt (opens in a new tab)YesToken max supply
initialSupplyBigInt (opens in a new tab)YesToken mint amount when deployed

Signers

  • deployer: Deployer of the token will be assigned as the owner of the token.

SetMerkleRootAction

SetMerkleRootAction is an action that sets the Merkle root of the AccumulativeMerkleTree.

Parameters

FieldTypeRequiredDescription
accumulativeMerkleDistributorAddressYesAccumulative merkle distributor address string
rootstringYesMerkle root string

Signers

  • owner: Owner address of the accumulative merkle distributor.

Utils

MerkleTree

Utility class for Merkle tree generation and proof verification.

interface MerkleTree {
  userRewardMapping: Record<Address, string>;
  tree: SimpleMerkleTree;
 
  constructor(userRewardMapping: Record<Address, string>): void;
  private generateTree(): SimpleMerkleTree;
  public getProof(userAddress: Address): ProofDetail;
  public getRoot(): string;
  public getAllProofs(): Record<Address, ProofDetail>;
}

Usage:

import { MerkleTree } from "@infinit-xyz/token/utils"
 
const merkleTree = new MerkleTree({
  userRewardMapping: {
    "0x1234567890abcdef1234567890abcdef12345678": "1000",
    "0xabcdef1234567890abcdef1234567890abcdef12": "2000"
  }
})
 
merkleTree.getRoot() // Returns the root hash of the Merkle tree.
merkleTree.getProof("0x1234567890abcdef1234567890abcdef12345678") // Returns the Merkle proof for the user address.
merkleTree.getAllProofs() // Returns the Merkle proof for all user addresses.