You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

81 lines
2.8 KiB

import { toBigInt } from "ethers";
import { ethers, upgrades } from "hardhat";
async function main() {
// console.log("開始部署FIL合約");
// const FIL = await ethers.getContractFactory("FIL");
// const fil = await FIL.deploy();
// console.log("FIL合約", fil.target);
const FIL_ADDRESS = process.env.FIL_ADDRESS
// const FIL_ADDRESS = fil.target
console.log('fil地址:', FIL_ADDRESS);
console.log("開始部署NFT合約");
const NFT = await ethers.getContractFactory("NFT");
const baseURI = "ipfs://QmXrE6iMBSHKe6jcLJnXtC9RtnUyjdJx9sBFbvLUTMunQv/metadata.json"
const nft = await NFT.deploy("SOFIL NFT", "SFSC", baseURI);
console.log("NFT合約", nft.target);
console.log("開始部署Pool合約");
const Pool = await ethers.getContractFactory("Pool");
const pool = await upgrades.deployProxy(Pool, [FIL_ADDRESS, nft.target], { initializer: "initialize" });
console.log("Pool合約", pool.target);
console.log("開始部署Pledge合約");
const Pledge = await ethers.getContractFactory("Pledge");
const pledge = await upgrades.deployProxy(
Pledge,
[nft.target, pool.target],
{ initializer: "initialize" }
);
console.log("Pledge合約", pledge.target);
console.log('執行初始化設置合約地址');
const tx = await nft.setPledgeAddress(pledge.target);
await tx.wait()
const tx1 = await pool.setPledgeContractAddress(pledge.target);
await tx1.wait()
// 主网删除
const tx2 = await pledge.setDayTime(toBigInt(60))
await tx2.wait()
// 測試使用
console.log('設置成功');
console.log('NFT的質押合約地址', await nft.pledgeAddress());
console.log('Pool的質押合約地址', await pool._pledgeContractAddress());
console.log('质押时间', await pledge.dayTime());
}
async function mainUpgradeProxy() {
// 3.1173
const poolAddress = "";
const pledgeAddress = "0xD8553004442098415734A9EFE49e13E29919BfF9";
// const Pool = await ethers.getContractFactory("Pool");
// const pool = await upgrades.upgradeProxy(poolAddress, Pool);
console.log('開始升級');
const Pledge = await ethers.getContractFactory("Pledge");
const pledge = await upgrades.upgradeProxy(pledgeAddress, Pledge);
console.log('升級成功');
// console.log("Pool合約", pool.address);
console.log("Pledge合約", pledge.target);
}
// We recommend this pattern to be able to use async/await everywhere
// and properly handle errors.
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});
// npx hardhat verify --network bscTest 0x8F7d8242d1A60f177e7389Bad8A7680FA50f2B89
// FIL合約 0x8F7d8242d1A60f177e7389Bad8A7680FA50f2B89
// NFT合約 0x8A50bd742312610b446286F43DF0DfB963f5fED5
// Pool合約 0x36821f56980814932530929C12dFC5fE80b50603
// Pledge合約 0x0d8e6b56FECEA32632a1B0fE73a84D4c5A2D44be