const { ethers } = require("hardhat"); async function main() { console.log("๐Ÿค– Deploying PacaBotManager on Base Network"); console.log("=========================================="); const [deployer] = await ethers.getSigners(); console.log(`๐Ÿ“ Deploying from account: ${deployer.address}`); console.log(`๐Ÿ’ฐ Account balance: ${ethers.formatEther(await deployer.provider.getBalance(deployer.address))} ETH`); // Get current gas price and add small buffer const gasPrice = await deployer.provider.getFeeData(); console.log(`โ›ฝ Current gas price: ${ethers.formatUnits(gasPrice.gasPrice, "gwei")} gwei`); // Deploy PacaBotManager console.log("\n๐Ÿš€ Deploying PacaBotManager contract..."); const BotManagerFactory = await ethers.getContractFactory("PacaBotManager"); const botManager = await BotManagerFactory.deploy({ gasPrice: gasPrice.gasPrice, // Use current network gas price }); console.log("โณ Waiting for deployment transaction to be mined..."); await botManager.waitForDeployment(); const botManagerAddress = await botManager.getAddress(); console.log(`โœ… PacaBotManager deployed successfully!`); console.log(`๐Ÿ“ Contract address: ${botManagerAddress}`); // Get deployment transaction details const deployTx = botManager.deploymentTransaction(); console.log(`๐Ÿงพ Deployment transaction: ${deployTx.hash}`); console.log(`โ›ฝ Gas used: ${deployTx.gasLimit.toString()}`); // Verify owner is set correctly console.log("\n๐Ÿ” Verifying deployment..."); try { const owner = await botManager.owner(); console.log(`๐Ÿ‘ค Contract owner: ${owner}`); console.log(`โœ… Owner matches deployer: ${owner.toLowerCase() === deployer.address.toLowerCase()}`); } catch (error) { console.log(`โš ๏ธ Could not verify owner: ${error.message}`); } console.log("\n๐Ÿ“‹ Deployment Summary"); console.log("===================="); console.log(`๐Ÿค– PacaBotManager: ${botManagerAddress}`); console.log(`๐Ÿ‘ค Owner: ${deployer.address}`); console.log(`๐ŸŒ Network: Base`); console.log(`๐Ÿงพ Transaction: ${deployTx.hash}`); console.log("\n๐Ÿ’ก Next steps:"); console.log("1. Verify the contract on BaseScan (optional)"); console.log("2. Authorize the bot manager on your PACA contracts"); console.log("3. Test the clearStakes functionality"); console.log("\n๐Ÿ”— BaseScan URL:"); console.log(` https://basescan.org/address/${botManagerAddress}`); } main() .then(() => process.exit(0)) .catch((error) => { console.error("๐Ÿ’ฅ Deployment failed:", error); process.exit(1); });