Currently deployed, has vesting tracker
This commit is contained in:
@@ -1,17 +1,24 @@
|
||||
const { ethers, upgrades, run } = require("hardhat");
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
require('dotenv').config();
|
||||
require('dotenv').config({ path: path.join(__dirname, '..', '.env') });
|
||||
|
||||
const deploymentFile = path.join(__dirname, "deployedAddresses.json");
|
||||
|
||||
async function main() {
|
||||
const privateKey = process.env.pk;
|
||||
const privateKey = process.env.PRIVATE_KEY;
|
||||
const network = await hre.network.name;
|
||||
|
||||
const wallet = new ethers.Wallet(privateKey, ethers.provider);
|
||||
const deployer = wallet.connect(ethers.provider);
|
||||
console.log(`Using private key for account: ${deployer.address}`);
|
||||
let deployer;
|
||||
if (network === "hardhat" || network === "localhost") {
|
||||
// Use default hardhat account for local testing
|
||||
[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}`);
|
||||
}
|
||||
console.log("Deploying contracts with the account:", deployer.address);
|
||||
|
||||
let deploymentData = {};
|
||||
@@ -19,12 +26,25 @@ async function main() {
|
||||
deploymentData = JSON.parse(fs.readFileSync(deploymentFile, "utf8"));
|
||||
}
|
||||
|
||||
const contractName = network === "mainnet"
|
||||
? "PacaFinanceWithBoostAndScheduleUSDT"
|
||||
: "PacaFinanceWithBoostAndScheduleUSDC";
|
||||
|
||||
// Select contract and proxy address based on network
|
||||
let contractName;
|
||||
let proxyAddress;
|
||||
if (!deploymentData.proxyAddress) {
|
||||
if (network === "base") {
|
||||
contractName = "PacaFinanceWithBoostAndScheduleBase";
|
||||
proxyAddress = process.env.PROXY_ADDRESS_BASE;
|
||||
} else if (network === "sonic") {
|
||||
contractName = "PacaFinanceWithBoostAndScheduleSonic";
|
||||
proxyAddress = process.env.PROXY_ADDRESS_SONIC || deploymentData.proxyAddress;
|
||||
} else if (network === "mainnet") {
|
||||
contractName = "PacaFinanceWithBoostAndScheduleBsc";
|
||||
proxyAddress = process.env.PROXY_ADDRESS_BSC || deploymentData.proxyAddress;
|
||||
} else {
|
||||
// Default to BSC for other networks (like test networks)
|
||||
contractName = "PacaFinanceWithBoostAndScheduleBsc";
|
||||
proxyAddress = deploymentData.proxyAddress;
|
||||
}
|
||||
|
||||
if (!proxyAddress) {
|
||||
// Initial deployment
|
||||
console.log("Deploying proxy...");
|
||||
const Paca = await ethers.getContractFactory(contractName, deployer);
|
||||
@@ -46,12 +66,9 @@ async function main() {
|
||||
await verifyContract(implementationAddress, contractName);
|
||||
} else {
|
||||
// Upgrade
|
||||
proxyAddress = deploymentData.proxyAddress;
|
||||
console.log("Upgrading proxy...");
|
||||
|
||||
const Paca = await ethers.getContractFactory(contractName, deployer);
|
||||
// //commen tout for mainet
|
||||
// await upgrades.forceImport(proxyAddress, Paca);
|
||||
|
||||
// Get current implementation for comparison
|
||||
const oldImplementationAddress = await upgrades.erc1967.getImplementationAddress(proxyAddress);
|
||||
|
||||
Reference in New Issue
Block a user