Web3 & AI

SOLUTIONS

Products

Services

Web3 & AI

SOLUTIONS

Services

Products

Industries

Become Our Client

About Us

Resources

Web3 & AI

SOLUTIONS

Services

Products

Industries

  • Access global liquidity for your RWA project with TMX Tokenize’s Canton Network integration

DISCOVER NOW

  • Access global liquidity for your RWA project with TMX Tokenize’s Canton Network integration

    JOIN NOW

DISCOVER

  • Access global liquidity for your RWA project with TMX Tokenize’s Canton Network integration

Download

TCHF

SMART CONTRACT DEVELOPMENT CASE STUDY

Executive Summary

The TCHF smart contract project demonstrates the development of a secure, ERC-20–based utility token system designed for restricted investment participation through whitelist controls. By leveraging Merkle Proofs and rigorous testing on the Sepolia testnet, the project ensures efficient dividend distribution, strong security, and controlled access for qualified participants, ultimately showcasing a scalable and reliable framework for blockchain-based investment fund operations.

Key Results

  • Secure whitelist system implemented using Merkle Proofs for authorized participation

  • Improved gas efficiency and streamlined dividend distribution

  • Successful deployment and testing on Sepolia testnet

  • All core smart contract functions executed successfully

  • Robust admin controls established (e.g., role assignment, profit setting)

  • Transparent tracking of total investments and dividends

  • Verified dividend distribution to eligible token holders

  • Enhanced security through strict access control and validation mechanisms

About TCHF 

TCHF token is a part of EA Capital Oy's proof-of-concept project, which aims to create an investment fund around digital assets. The purpose of TCHF token is to tokenize some proprietary trading functions of the fund. This would allow sharing the trading strategies among other parties.

The token is not intended for the general public and will be offered only to qualified parties with shared interests. TCHF is categorized as an ERC-20 utility token, which is not fully decentralized.

In this case study, we examine the development and testing of a smart contract for the TCHF project on the Sepolia testnet, leveraging ERC20 technology.

THCF Smart Contract Project’s Goal

The goal of this project is to enable investments exclusively from whitelisted addresses through a secure and efficient system, ensuring that only authorized participants can engage with the ecosystem. This approach is designed to streamline the investment process while maintaining high standards of security and operational efficiency.

THCF Smart Contract Project’s Success

By integrating a Merkle Proof, we enhanced gas efficiency and security, streamlining the dividend distribution process. Testing on the Sepolia testnet ensured the contract's functionality and security in a controlled environment, showcasing our commitment to delivering innovative and secure blockchain solutions.

About Merkle Proofs

  • Merkle Proofs

Cryptographic technique for verifying element inclusion within large datasets like Merkle trees

  • Whitelist Management
    Focuses on using Merkle proofs to manage a whitelist in blockchain systems.

  • Whitelist Use

Contains addresses granted special privileges or permissions within the blockchain ecosystem.

Steps for Implementing Merkle Proofs

  1. Install Hardhat

  2. Install Dev Dependencies

  3. Add wallet address in the whitelist

  4. Generate Merkle-whitelist

  5. Add merkle root to minting contract

  6. Generate merkle proof

  7. Add proof to mint function

Testing Approach

Our testing strategy for the TCHF project's smart contract encompassed a comprehensive blend of dynamic and static analyses, conducted on the Sepolia testnet. This approach included:

  1. Dynamic Analysis

Evaluated the contract's functionality under various scenarios on the testnet to ensure robustness.

  1. Static Analysis

Conducted a detailed code review to ensure logic optimization and best practice adherence for security and efficiency.

  1. Key Function 

Key Function were tested to confirm their operational integrity and the secure management of dividends and whitelisting

  1. Limiters and Security Measures

Validated contract defenses, focusing on Merkle root use for secure whitelist verification.

Key Functions Tested

In the development of the TCHF project's smart contract, our testing methodology was centered around ensuring the system's functionality, security, and efficiency through the rigorous examination of key functions. This process was critical in validating the smart contract's ability to securely manage investments and dividends for whitelisted addresses, leveraging the power of blockchain technology. Key functions tested:

  1. grantRole()

  2. getTotalInvestedTCHFs()

  3. setTradingProfitsInWei()

  4. setWhitelistMerkleRoot()

  5. claimDividend()

Test 1: grantRole()

The grantRole function assigns administrative privileges to specified wallets in the TCHFDividend contract, accessible only by the contract deployer to ensure secure contract management. This function plays a pivotal role in conferring administrative authority, ensuring that only authorized administrators can modify the contract's state and perform critical operations.

Transaction Status: Successful

Result:

Above input wallet address has been granted with the Admin Role.

Test 2: getTotalInvestedTCHFs()

The getTotalInvestedTCHFs function is exclusive to administrators for tracking the total TCHF tokens invested, enhancing transparency by querying the total supply of TCHF tokens from the underlying token contract. It also facilitating the assessment of participation within the TCHFDividend system.

Transaction Status: Successful

Result:

Value Retrieved.

Test 3: setTradingProfitsInWei()

The setTradingProfitsInWei() function allows administrators to adjust trading profits in wei in the TCHFDividend contract, offering flexibility to change dividend distributions based on trading outcomes, ensuring adaptability to market conditions for optimizing dividends for token holders.

Transaction Status: Successful

Result:

Trading profits are assigned a value of 1000000000000000 Wei.

Test 4: setWhitelistMerkleRoot()

The setWhitelistMerkleRoot() function allows only authorized administrators to update the Merkle root for whitelist verification in the TCHFDividend contract, enabling efficient management of eligible addresses for dividend claims and ensuring security and adaptability to whitelist changes.

Transaction Status: Successful

Result:

The whitelist Merkle root hash has been successfully updated to the specified value.

Test 5: claimDividend()

The claimDividend() function allows TCHF token holders to claim dividends by providing Merkle proof of eligibility and meeting conditions like having a non-zero token balance and not having claimed dividends before. Successful verification leads to dividend distribution to the claimant's wallet.

Transaction Status: Successful

Result:

The claimDividend() function disburses 0.000166666666666666 ETH as dividends to the claimant's wallet from the TCHFDividend contract upon successful execution, with an event log confirming the transaction and claimant's address. This allows claimants to verify dividend receipt in their wallets.

Conclusion

This case study demonstrated the effective development and testing of the TCHFDividend smart contract, focusing on secure and efficient dividend distribution for whitelisted TCHF token holders. Rigorous testing on the Sepolia testnet confirmed the functionality of critical features. The implementation of a whitelist mechanism through the Merkle root stands out as a key innovation, ensuring that only eligible investors participate, thereby enhancing security and operational efficiency. This approach sets a new standard for managing blockchain-based dividend systems, highlighting the potential for targeted and secure investor engagement.

Partner with TokenMinds to Develop Smart Contract for your Business

Schedule a free consultation here

Schedule a free call with us now