Coin Hunters Services
  • Introduction
  • Mainnet
    • Avail
      • Installation
      • Upgrade
    • Babylon
      • Installation
      • Service
      • Useful commands
      • Snapshot
    • CrossFi
      • Service
      • Installation
      • Useful commands
    • Dymension
      • Service
      • Installation
      • Snapshots
      • Useful commands
      • Upgrade
    • Lava Network
      • Service
      • Installion
      • Snapshots
      • Useful commands
    • Nibiru
      • Service
      • Installation
      • Useful commands
      • Snapshot
    • Zeta Chain
      • Service
      • Installation
      • Useful commands
      • Upgrade
    • Mantra Chain
      • Installation
      • Service
      • Useful commands
      • Snapshot
    • Rivalz
      • zNode
    • Kopi Money
      • Installation
      • Service
      • Useful commands
      • Snapshot
      • Upgrade
    • Story Protocol
      • Story Mainnet
        • Installation
        • Snapshots
        • Service
        • Upgrade
    • Side Protocol
      • Installation
      • Snapshots
      • Useful commands
    • Fuel Network
      • Installation
      • Snapshots
      • Useful commands
  • Testnet
    • 0G Labs
      • Service
      • Installation
      • Useful commands
      • 0G-Newton
        • Service
        • Installation
        • Useful commands
        • Snapshots
    • Airchains
      • Varanasi
        • Service
        • Installation
        • Snapshots
        • Useful commands
      • Junction
        • Service
        • Installation
        • Snapshots
        • Useful commands
      • Rollup Evm Airchains
      • Auto TX Script
    • AligendLayer
      • Installation
    • Allora Network
      • Service
      • Installation
      • Snapshots
      • Useful commands
      • Worker Node
    • Artela Network
      • Service
      • Installation
      • Snapshots
      • Useful commands
    • Avail
      • Installation
      • Update v2.2.1
    • Babylon
      • Installation
      • Useful commands
    • CrossFi
      • Service
      • Installation
      • Useful commands
      • Snapshots
    • Dill
      • Andes
      • Alps
    • Dymension
      • Service
      • Installation
      • Useful commands
    • Elys Network
      • Service
      • Installation
      • Snapshots
      • Useful commands
    • Empeiria
      • Service
      • Installation
      • Snapshots
      • Useful commands
    • Ethernity Chain
      • Deploy a Smart Contract and Verify
      • Create an ERC-20 token and Verify
      • Create an NFT Collection and Verify
    • Farcaster Node Hubble
      • Upgrade
    • Fiamma Chain
      • Service
      • Installation
      • Snapshots
      • Useful commands
    • Initia
      • Service
      • Installation
      • Snapshots
      • Useful commands
    • Lava Network
      • Service
      • Installation
      • Useful commands
    • Mantra Chain
      • Hongbai Testnet
        • Service
        • Installation
        • Snapshots
        • Useful commands
      • Dukong Testnet
        • Service
        • Installation
        • Snapshot
        • Useful commands
    • Nillion Network
      • Service
      • Installation
      • Snapshots
      • Useful commands
      • Verifier Program
    • Nubit
      • Light Node
      • Installation Validator
    • PINGPONG
      • Installation
      • 0G Storage Kurulumu
      • Grass Kurulumu
    • Rivalz
      • Linux Client
    • Side Protocol
      • S3 Tesnet
        • Service
        • Installation
        • Useful commands
      • S2 Incentivized Testnet
        • Installation
        • Useful commands
      • S4 Incentivized Tesnet
        • Service
        • Installation
        • Useful commands
        • Snapshots
    • Sunrise Layer
      • Service
      • Installation
      • Snapshots
      • Useful commands
      • Manual upgrade
    • Union
      • Service
      • Testnet-9
        • Installation
        • Snapshots
        • Useful commands
      • Testnet-8
        • Installation
        • Snapshots
        • Useful commands
    • Warden Protocol
      • Service
      • Installation
      • Snapshots
      • Useful commands
      • Chiado Testnet
        • Installation
        • Useful commands
    • Zero Network
      • Deploy a Smart Contract
    • Story Protocol
      • illiad Testnet
        • Installation
        • Snapshots
        • Upgrade
      • Odyssey testnet
        • Service
        • Installation
        • Snapshots
        • Useful Tool
      • Story Aeneid
        • Installation
        • Snapshots
        • Service
    • Hemi Network
    • Axone Chain
      • Service
      • Installation
      • Snapshots
      • Useful commands
    • Glacier Network
      • Installation
    • Pipe Network
      • Installation
    • Pell
      • Service
      • Installation
      • Snapshots
      • Useful commands
    • Native Network
      • Service
      • Installation
      • Snapshots
      • Useful commands
    • XRPL EVM
      • Installation
      • Useful commands
      • Snapshot
      • Service
    • Lumera Protocol
      • Installation
      • Useful commands
      • Snapshot
      • Service
Powered by GitBook
On this page
  1. Testnet
  2. Ethernity Chain

Create an ERC-20 token and Verify

Deploy a smart contract yayınladığınız yerden devam edebilirsiniz.

mkdir token && cd token

npm projesini başlatıyoruz.

npm init -y
npm install --save-dev hardhat ts-node typescript @nomicfoundation/hardhat-toolbox ethers@^6.1.0 dotenv @nomicfoundation/hardhat-verify hardhat ts-node typescript @nomicfoundation/hardhat-toolbox ethers @openzeppelin/contracts dotenv
npx hardhat

İstendiğinde, "Create a TypeScript project" seçeneğini seçin ve .gitignore ve bağımlılıklar için "Yes" yanıtını verin.

cd contracts
rm Lock.sol
nano Token.sol

Aşağıdaki Token. Sol içindeki "My Token" ve "TOK" simgelerini kendinize göre değiştirebilirisiniz. Size kalmış.

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

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

contract Token is ERC20 {
    constructor(uint256 initialSupply) ERC20("My Token", "TOK") {
        _mint(msg.sender, initialSupply);
    }
}

Editörden çıkmak ve kaydetmek için Ctrl + X, ardından Y ve Enter tuşlarına basın.

cd ..
nano hardhat.config.ts

Aşağıdaki hiçbir bilgiyi değiştirmeden aynen ekliyoruz.

import { HardhatUserConfig } from "hardhat/config";
import "@nomicfoundation/hardhat-toolbox";
import "@nomicfoundation/hardhat-verify";
import * as dotenv from "dotenv";

dotenv.config();

const config: HardhatUserConfig = {
  etherscan: {
    apiKey: {
      ernscan: "ernscan", // API anahtarı gerekmiyor, sadece bir placeholder
    },
    customChains: [
      {
        network: "ernscan",
        chainId: 233,
        urls: {
          apiURL: "https://api.routescan.io/v2/network/testnet/evm/233/etherscan",
          browserURL: "https://testnet.ernscan.io"
        }
      }
    ]
  },
  networks: {
    "ethernity-testnet": {
      url: 'https://testnet.ethernitychain.io',
      chainId: 233,
      accounts: [process.env.PRIVATE_KEY!]
    }
  },
  solidity: {
    version: "0.8.20",
    settings: {
      optimizer: {
        enabled: true,
        runs: 200
      }
    }
  }
};

export default config;

şimdi .env dosyası oluşturuyoruz.

nano .env

Bu dosya içine metamask private key'imizi ekliyoruz.

PRIVATE_KEY=your_private_key_here

Token'imizi derleyelim.

npx hardhat compile

Token'imizi dağıtımı ve mint işlemini yapalım.

mkdir scripts
nano scripts/deploy.ts
import { ethers } from "hardhat";

async function main() {
    const initialSupply = ethers.parseUnits("1000000", 18); // 1,000,000 TOK
    const Token = await ethers.getContractFactory("Token");
    const token = await Token.deploy(initialSupply);
    await token.waitForDeployment();
    console.log("Token deployed to:", await token.getAddress());
}

main()
  .then(() => process.exit(0))
  .catch(error => {
    console.error(error);
    process.exit(1);
  });
npx hardhat run scripts/deploy.ts --network ethernity-testnet

Şimdi de tokenimizi verify yapıyoruz. Bunun için bir üstteki komutta size verilen kontrat adresini yazmanız yeterlidir.

npx hardhat verify --network ethernity-testnet <deployed_contract_address> 1000000000000000000000000
PreviousDeploy a Smart Contract and VerifyNextCreate an NFT Collection and Verify

Last updated 9 months ago

adresten gidip hem tokeninizi hem de Verify olup olmadığını kontrol edebilirsiniz.

https://testnet.ernscan.io/