Skip to main content

XIrafy Project

Building with @Ether eal

Status: Closed1 comment

Log in to comment and vote

Comments1

  • efik-coin

    •

    Oct 26, 2025

    // check-balance.js

    // npm i ethers

    const { ethers } = require("ethers");

    const RPC = "https://bsc-dataseed.binance.org/";

    const provider = new ethers.JsonRpcProvider(RPC);

    const TOKEN = "0xccbfa0d59551010e1eef983580f34e8d014df9e6";

    const ADDRESS = "0xC5AD5cfcF81AD63a94227334b898eafCe6B27cCA"; // your admin wallet

    async function main(){

    const abi = [

    "function balanceOf(address) view returns (uint256)",

    "function decimals() view returns (uint8)",

    "function symbol() view returns (string)",

    "function name() view returns (string)"

    ];

    const t = new ethers.Contract(TOKEN, abi, provider);

    const [bal, dec, sym, name] = await Promise.all([

    t.balanceOf(ADDRESS),

    t.decimals().catch(()=>18),

    t.symbol().catch(()=>"EFIK"),

    t.name().catch(()=>"Efikcoin")

    ]);

    console.log(`${name} (${sym}) decimals: ${dec}`);

    const human = Number(ethers.formatUnits(bal, dec));

    console.log(`Raw balance: ${bal.toString()}`);

    console.log(`Human balance: ${human}`);

    }

    main().catch(console.error);