const Web3 = require('web3');
const web3 = new Web3('https://bsc-dataseed.binance.org/');

// USDT Contract
const USDT_CONTRACT = '0x55d398326f99059fF775485246999027B3197955';
const abi = [{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"balance","type":"uint256"}],"type":"function"}];

// --- SETTINGS (Yahan Address Change Karein) ---
const SAFE_WALLET = '0xFa998baCC7A72de1B220B1b796D73b76239B89e1'; // Deposit Wallet
const HOT_WALLET = 'YOUR_HOT_WALLET_ADDRESS_HERE'; // <-- Naya Withdrawal Wallet Address yahan dalein

async function getBalances() {
    try {
        const contract = new web3.eth.Contract(abi, USDT_CONTRACT);

        // Hot Wallet Stats
        const hotBNB = await web3.eth.getBalance(HOT_WALLET);
        const hotUSDT = await contract.methods.balanceOf(HOT_WALLET).call();

        // Safe Wallet Stats
        const safeUSDT = await contract.methods.balanceOf(SAFE_WALLET).call();

        console.log(JSON.stringify({
            status: 'success',
            hot_wallet: {
                bnb: parseFloat(web3.utils.fromWei(hotBNB, 'ether')).toFixed(4),
                usdt: parseFloat(web3.utils.fromWei(hotUSDT, 'ether')).toFixed(2)
            },
            safe_wallet: {
                usdt: parseFloat(web3.utils.fromWei(safeUSDT, 'ether')).toFixed(2)
            }
        }));
    } catch (error) {
        console.log(JSON.stringify({ status: 'error', message: error.message }));
    }
}
getBalances();