change WUSD payment to USDC

This commit is contained in:
2025-12-24 16:41:26 +08:00
parent d2e9377f78
commit e21ee7a5df
160 changed files with 6038 additions and 4050 deletions

View File

@@ -39,21 +39,29 @@ async function main() {
// ==================== 2. 部署核心合约 ====================
console.log("\n===== 2. 部署核心合约 =====");
if (!fs.existsSync("./deployments-wusd.json")) {
throw new Error("未找到 deployments-wusd.json请先运行 deployWUSD.ts");
// 读取USDC配置
if (!fs.existsSync("./deployments-usdc-config.json")) {
throw new Error("未找到 deployments-usdc-config.json请先运行 01-prepareUSDC.ts");
}
const wusdDeployment = JSON.parse(fs.readFileSync("./deployments-wusd.json", "utf8"));
const wusdAddress = wusdDeployment.contracts.WUSD.proxy;
const usdcConfig = JSON.parse(fs.readFileSync("./deployments-usdc-config.json", "utf8"));
const usdcAddress = usdcConfig.contracts.USDC.address;
const usdcPriceFeedAddress = usdcConfig.contracts.ChainlinkUSDCPriceFeed.address;
console.log("USDC地址: ", usdcAddress);
console.log("Chainlink价格预言机: ", usdcPriceFeedAddress);
// 部署YTPriceFeed (可升级)
console.log("部署YTPriceFeed...");
// 部署YTPriceFeed (可升级) - 传入USDC和Chainlink地址
console.log("\n部署YTPriceFeed...");
const YTPriceFeed = await ethers.getContractFactory("YTPriceFeed");
const priceFeed = await upgrades.deployProxy(YTPriceFeed, [wusdAddress], {
kind: "uups",
initializer: "initialize"
});
const priceFeed = await upgrades.deployProxy(
YTPriceFeed,
[usdcAddress, usdcPriceFeedAddress], // 传入两个参数
{
kind: "uups",
initializer: "initialize"
}
);
await priceFeed.waitForDeployment();
const priceFeedAddress = await priceFeed.getAddress();
console.log("✅ YTPriceFeed deployed to:", priceFeedAddress);