In this guide, we will walk you through how to operate an ERC20F token. There are five functions available:Documentation Index
Fetch the complete documentation index at: https://fireblocks-43c4b3ee-chore-add-cli.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
- Deploy
- Mint
- Burn
- Grant Role
- Revoke Role
Prerequisites
Before operating an ERC20F token using the Fireblocks SDK, ensure you know the following:- ERC20F Contract Address: The address of the ERC20F token contract you want to manage.
-
Vault Account (for minting/burning): The
vaultAccountIdwill either mint or burn tokens. You only need the vault account to have the role required for the specific action—either theMINTER_ROLEfor minting or theBURNER_ROLEfor burning. Ensure the vault has sufficient native gas for transaction fees. You can retrieve thevaultAccountIdfrom the Fireblocks console by checking the URL of the selected vault, e.g.,https://console.fireblocks.io/v2/accounts/vault/<vaultAccountId>. For more details about Vault Accounts, refer to the Create Vault Account guide. -
Vault Account (for granting roles): The
vaultAccountIdis responsible for granting roles. Ensure this vault also has sufficient native gas for transaction fees. -
Implementation Contract ABI: The
ABIof the implementation contract of the ERC20F token. This is required to interact with the token contract. For more details about how to retrieve the ABI, refer to the Issue New ERC20F Tokens guide. -
BaseAssetId ID: The
baseAssetIdof the blockchain where the token is deployed (e.g. ETH_TEST5 for Sepolia). This is the Fireblocks ID of the gas token of the blockchain where the token is deployed. (To get the base asset ID, refer to this base assetId list)
Preparation steps
Here’s an example of how to prepare the Fireblocks SDK to interact with the ERC20F token contract:1. Initialize the Fireblocks SDK
First, import ethers and the Fireblocks SDK, and initialize the SDK with your Fireblocks API key and private key:Example: Mint Tokens
Minting tokens allows you to create new tokens and assign them to a specific address. In this example, theMINTER_ROLE has already been granted to an address during deployment.
Note: TheFirst, define the parameters for minting tokens:vaultAccountIdused in the request must have theMINTER_ROLE. If the account does not have this role, the minting transaction will fail.
recipientAddress: The address to receive the tokens.amount: The fixed-point (integer) representation of the amount of tokens to burn. SinceERC20Ftoken has 18 decimals, 1 token can be represented as1 * 10^18wei. The amount should be specified in wei.
mint function from the implementation contract ABI initially retrieved. Here’s how to mint the tokens:
Example: Burn Tokens
Burning tokens allows you to remove tokens from circulation. In this example, theBURNER_ROLE has not been granted to an address during deployment. So we need to grant the BURNER_ROLE to an address before burning tokens.
Note: TheAdditionally, ensure that the vault account initiating the burn transaction has enough tokens to burn from its balance, as the transaction will fail if the balance is insufficient. For more information on how to grant roles to addresses, refer to the Setting Up Roles in ERC20F Tokens guide. Example:vaultAccountIdused in the request must have theBURNER_ROLE. If the account does not have this role, the burn transaction will fail.
amount: The fixed-point (integer) representation of the amount of tokens to burn. SinceERC20Ftoken has 18 decimals, 1 token can be represented as1 * 10^18wei. The amount should be specified in wei.
burn function from the implementation contract ABI initially retrieved. Here’s how to burn the tokens: