Approving new tokens
Overview
This guide outlines the process for approving a new token registration within a Rayls Private Subnet. After a Privacy Ledger owner submits a token registration request, the Subnet Operator reviews and approves the registration using available scripts, following the subnet’s governance rules.
In the Commit Chain ecosystem, tokens must be approved by the operator before they can be fully utilized. Each token is assigned a unique resourceId
at the time of the request, which serves as the identifier for approval. The resourceId
is visible to the operator when listing pending token approvals and is crucial for completing the approval process.
Prerequisites
Before proceeding with the approval of a new token registration, ensure the following requirements are met:
- Environment Setup:
- Regular development environment with Node.js, Hardhat, and TypeScript installed.
- Make, Git, Docker, and Docker Compose are set up if using containerized workflows.
- Scripts & Network Details:
- The approval scripts (
approveToken
,approveLastToken
,approveAllTokens
) should be available and configured for the environment. - Obtain the necessary network parameters such as the
Commit Chain URL
andChain ID
. - Have the
resourceId
for the pending token(s) available.
- The approval scripts (
Step-by-Step
To streamline the approval process, three scripts are provided, allowing the Subnet Operator to approve tokens using different approaches:
- Approve a specific token by
resourceId
: Using theapproveToken
script. - Approve the last pending token: Using the
approveLastToken
script. - Approve all pending tokens: Using the
approveAllTokens
script.
These scripts utilize Hardhat tasks and TypeScript to simplify interactions with the blockchain, automating contract calls for seamless token approvals. Note that there is no explicit rejection process for token registrations; ignoring a token acts as a refusal.
Approving a new token enables it to be issued, transferred, and used in transactions within the subnet, supporting various financial operations while maintaining compliance and security standards.
Follow these steps to approve a new token registration within a Rayls Private Subnet:
1. Verify Pending Token Approvals
List All Tokens and Their Statuses:
Use the getAllTokens
command to retrieve all tokens registered in the TokenRegistry
and check their current statuses.
Example:
npx hardhat getAllTokens --rpc-url \<RPC_URL_NODE_CC> --contract-address \<TOKEN_REGISTRY_ADDRESS>
Look for tokens with a status indicating that they are pending approval, and note their resourceId
.
2. Approve the Token
Choose Approval Script:
Script 1: Approve a Specific Token by resourceId
:
Use the approveToken
script to approve a token with a known resourceId
.
Parameters:
rpcUrlNodeCc
: The URL of the JSON-RPC API from the Commit Chain.contractAddress
: The address of theTokenRegistry
contract.resourceId
: The identifier of the token to be approved.privateKeySystem
: The operator's private key for signing the transaction.
Example:
npx hardhat approveToken --rpc-url \<RPC_URL_NODE_CC> --contract-address \<TOKEN_REGISTRY_ADDRESS> --resource-id \<TOKEN_RESOURCE_ID> --private-key-system \<PRIVATE_KEY>
Success Message:
✅ The token with resourceId \<TOKEN_RESOURCE_ID> got approved!
Script 2: Approve the Last Pending Token:
This script automatically approves the last pending token in the TokenRegistry
.
Example:
npx hardhat approveLastToken --rpc-url \<RPC_URL_NODE_CC> --contract-address \<TOKEN_REGISTRY_ADDRESS> --private-key-system \<PRIVATE_KEY>
Success Message:
✅ The token "TokenName" (TokenSymbol) got approved!
Script 3: Approve All Pending Tokens:
This script approves all tokens currently pending in the TokenRegistry
.
Example:
npx hardhat approveAllTokens --rpc-url \<RPC_URL_NODE_CC> --contract-address \<TOKEN_REGISTRY_ADDRESS> --private-key-system \<PRIVATE_KEY>
Success Message:
✅ The token "TokenName" (TokenSymbol) got approved! (repeated for each token)
Execute Selected Script:
Run the chosen command, replacing the placeholders (RPC_URL_NODE_CC
, TOKEN_REGISTRY_ADDRESS
, TOKEN_RESOURCE_ID
, PRIVATE_KEY
) with the actual values.
Watch for success messages confirming that the token approval was completed.
3: Confirm Token Registration Approval
Recheck the Token Statuses:
Run the getAllTokens
command again to confirm that the status of the approved token has changed accordingly.
Updated 3 days ago