43 lines
1.5 KiB
JavaScript
43 lines
1.5 KiB
JavaScript
const { ethers, upgrades } = require("hardhat");
|
|
const path = require("path");
|
|
require('dotenv').config({ path: path.join(__dirname, '..', '.env') });
|
|
|
|
async function main() {
|
|
const privateKey = process.env.PRIVATE_KEY;
|
|
const network = await hre.network.name;
|
|
|
|
let deployer;
|
|
if (network === "hardhat" || network === "localhost") {
|
|
[deployer] = await ethers.getSigners();
|
|
console.log(`Using default hardhat account: ${deployer.address}`);
|
|
} else {
|
|
const wallet = new ethers.Wallet(privateKey, ethers.provider);
|
|
deployer = wallet.connect(ethers.provider);
|
|
console.log(`Using private key for account: ${deployer.address}`);
|
|
}
|
|
|
|
// Get BSC proxy address from env
|
|
const proxyAddress = process.env.PROXY_ADDRESS_BSC;
|
|
if (!proxyAddress) {
|
|
console.error("PROXY_ADDRESS_BSC not found in .env file");
|
|
process.exit(1);
|
|
}
|
|
console.log(`Importing BSC proxy at: ${proxyAddress}`);
|
|
|
|
// Get the current implementation contract factory
|
|
const Paca = await ethers.getContractFactory("PacaFinanceWithBoostAndScheduleBsc", deployer);
|
|
|
|
// Force import the proxy to fix artifacts
|
|
console.log("Force importing proxy...");
|
|
await upgrades.forceImport(proxyAddress, Paca);
|
|
|
|
console.log("✅ BSC proxy imported successfully!");
|
|
console.log("You can now delete this script and run normal upgrades.");
|
|
}
|
|
|
|
main()
|
|
.then(() => process.exit(0))
|
|
.catch((error) => {
|
|
console.error(error);
|
|
process.exit(1);
|
|
}); |