|
|
@ -12,34 +12,35 @@ async function main() { |
|
|
|
|
|
|
|
console.log("開始部署NFT合約"); |
|
|
|
const NFT = await ethers.getContractFactory("NFT"); |
|
|
|
const nft = await NFT.deploy("MyNFT", "MNFT"); |
|
|
|
const baseURI = "ipfs://QmQpgq4FvXNHZfoytpiwk617Nozmeu7iMiyiSzthVg1ZV7/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" }); |
|
|
|
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], |
|
|
|
[nft.target, pool.target], |
|
|
|
{ initializer: "initialize" } |
|
|
|
); |
|
|
|
console.log("Pledge合約", pledge.target); |
|
|
|
|
|
|
|
console.log('執行初始化設置合約地址'); |
|
|
|
const tx = await nft.setPledgeAddress(pledge.target); |
|
|
|
const tx = await nft.setPledgeAddress(pledge.target); |
|
|
|
await tx.wait() |
|
|
|
const tx1 = await pool.setPledgeContractAddress(pledge.target); |
|
|
|
await tx1.wait() |
|
|
|
// 測試使用
|
|
|
|
console.log('設置成功'); |
|
|
|
|
|
|
|
console.log('NFT的質押合約地址',await nft.pledgeAddress()); |
|
|
|
console.log('Pool的質押合約地址',await pool._pledgeContractAddress()); |
|
|
|
console.log('质押时间',await pledge.dayTime()); |
|
|
|
console.log('NFT的質押合約地址', await nft.pledgeAddress()); |
|
|
|
console.log('Pool的質押合約地址', await pool._pledgeContractAddress()); |
|
|
|
console.log('质押时间', await pledge.dayTime()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|