diff --git a/scripts/deploy.ts b/scripts/deploy.ts index 04d65a0d..ec2acf33 100644 --- a/scripts/deploy.ts +++ b/scripts/deploy.ts @@ -1,12 +1,24 @@ -import '@nomiclabs/hardhat-ethers'; import { ethers } from "hardhat"; async function main() { + // 部署工厂创建合约 + const wkFactory = await ethers.getContractFactory("Factory"); + const factory = await wkFactory.deploy() + console.log(`Factory deployed to ${factory.address}`); + + // 部署TokenA, TokenB合约 const FT = await ethers.getContractFactory("FT"); const ft = await FT.deploy("CBI", "CUIT"); + const TokenA = await FT.deploy("TokenA", "[A]"); + console.log(`Token0 deployed to ${TokenA.address}`); + const TokenB = await FT.deploy("TokenB", "[B]"); + console.log(`Token1 deployed to ${TokenB.address}`); await ft.deployed(); console.log(`FT deployed to ${ft.address}`); + // 创建币对交易池子 + const wkSwap = await factory.createPair(TokenA.address, TokenB.address); + console.log(`Swap deployed to ${wkSwap.address}`); } // We recommend this pattern to be able to use async/await everywhere @@ -15,3 +27,4 @@ main().catch((error) => { console.error(error); process.exitCode = 1; }); +});