65 lines
2.7 KiB
JavaScript
65 lines
2.7 KiB
JavaScript
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);
|
|
}); |