Commit before cuna

This commit is contained in:
2025-09-04 02:48:34 +02:00
parent 7e55515063
commit 8ef7f0b9f1
32 changed files with 4668 additions and 17 deletions

View File

@@ -0,0 +1,65 @@
const { ethers } = require("hardhat");
async function main() {
console.log("🤖 Deploying PacaBotManager on BSC Mainnet");
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))} BNB`);
// 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: BSC Mainnet`);
console.log(`🧾 Transaction: ${deployTx.hash}`);
console.log("\n💡 Next steps:");
console.log("1. Verify the contract on BSCScan (optional)");
console.log("2. Authorize the bot manager on your PACA contracts");
console.log("3. Test the clearStakes functionality");
console.log("\n🔗 BSCScan URL:");
console.log(` https://bscscan.com/address/${botManagerAddress}`);
}
main()
.then(() => process.exit(0))
.catch((error) => {
console.error("💥 Deployment failed:", error);
process.exit(1);
});