This repository shows how to update custom fees for HTS tokens (fungible and NFT) via a smart contracts, which is enabled by HIP-1010. The example demonstrates how to interact with HTS precompiles using standard Solidity interfaces, enabling developers to work with Hedera tokens using familiar ERC-like patterns.
-
Enter your Hedera testnet credentials in the
.env
file -
Run tests for fungible tokens, NFTs, or both:
Fungible Token NFT npx hardhat test ./test/updateFungibleTokenFeeViaContract.test.js
npx hardhat test ./test/updateNftFeeViaContract.test.js
-
Clone the repository
git clone https://github.com/ed-marquez/hedera-example-update-token-fees-via-contract-hip-1010.git
-
Copy
.env.sample
to.env
and add your environment variables (and Hedera testnet credentials)cp .env.sample .env
-
Install dependencies
npm install
-
Run tests for fungible tokens, NFTs, or both:
npx hardhat test ./test/updateFungibleTokenFeeViaContract.test.js
npx hardhat test ./test/updateNftFeeViaContract.test.js
npx hardhat test
-
Follow the instructions in the terminal
.env
: Account credentials and environment variableshardhat.config.js
: Hardhat configuration including network settings and compiler optionsconstants.js
: Network configurations and default valuesutils/tokenOperations.js
: Functions for creating and managing HTS tokensutils/contractInterfaces.js
: ABI interfaces for HTS precompile interactionstest/
: Test files demonstrating HTS precompile usage patterns