DEV Community

BHAVESHSINGH
BHAVESHSINGH

Posted on

Building ERC20 for Web3 Apps at @EtherAuthority

@etherauthority using @securechainai

In this guide, we will write and deploy a basic Task Completion Token (TCT) ERC20 contract using the Remix IDE and configure it specifically for deployment on the SecureChain AI (SCAI) network.


1. The Smart Contract Code

Below is the straightforward ERC20 implementation for the Task Completion Token utilizing OpenZeppelin contracts.

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

contract TaskCompletionToken is ERC20, Ownable {

    constructor() ERC20("TaskCompletion", "TCT") Ownable(msg.sender) {
        // Mint an initial supply of 1,000 tokens to the deployer
        _mint(msg.sender, 1000 * 10 ** decimals());
    }

    /**
     * @notice Mints new TCT rewards to a specific worker address
     * @dev Restricted strictly to the contract owner/verifier
     */
    function mint(address to, uint256 amount) public onlyOwner {
        _mint(to, amount);
    }
}
Enter fullscreen mode Exit fullscreen mode

2. Compiling in Remix IDE (Critical SCAI Configuration)

When deploying on SecureChain AI (SCAI), using the default compiler settings will cause deployment transactions to fail. This is because modern Solidity compilers default to the Cancun EVM fork, which introduces opcodes like PUSH0 that may not be supported by the network.

To prevent runtime deployment reverts, we must manually target the Paris EVM hardfork.

Step-by-Step Compilation Setup:

  • Open Remix IDE.

  • Create a new file named TaskCompletionToken.sol and paste the code provided above.

  • Move to the Solidity Compiler tab on the left sidebar menu.

  • Expand the Advanced Configurations dropdown menu.

  • Change the EVM Version setting explicitly from default to paris.

  • Click Compile TaskCompletionToken.sol.

3. Deploying to the Network

  • Once compiled with the correct EVM settings, you can push the contract live:

  • Navigate to the Deploy & Run Transactions tab in Remix.

  • Change your Environment to Injected Provider - MetaMask (ensure your MetaMask wallet is connected to the SecureChain AI / SCAI network).

  • Ensure Value is set to 0 wei.

  • Select TaskCompletionToken from the contract dropdown field.

  • Click Deploy and confirm the transaction signature inside your wallet interface.

Top comments (0)