fix contract

This commit is contained in:
2026-01-12 14:33:16 +08:00
parent a18b9a42e4
commit d56f83726b
70 changed files with 1988 additions and 142 deletions

View File

@@ -65,9 +65,11 @@ async function main() {
console.log(" ✅ 添加YTPoolManager");
// 配置YTLPToken权限
console.log("配置YTLPToken minter权限...");
console.log("配置YTLPToken权限...");
await ytLP.setMinter(poolManagerAddress, true);
console.log(" ✅ 设置YTPoolManager为minter");
await ytLP.setPoolManager(poolManagerAddress);
console.log(" ✅ 设置PoolManager用于转账时继承冷却时间");
// 配置Vault权限
console.log("配置YTVault权限...");
@@ -87,6 +89,15 @@ async function main() {
// USDC价格从Chainlink获取无需设置价格来源
console.log("✅ USDC价格从Chainlink自动获取");
// 根据网络设置价格过期阈值
const network = await ethers.provider.getNetwork();
const isTestnet = network.chainId === 97n || network.chainId === 11155111n; // BSC测试网或Sepolia
const priceStalenesThreshold = isTestnet ? 86400 : 3600; // 测试网24小时主网1小时
console.log("设置价格过期阈值...");
await priceFeed.setPriceStalenessThreshold(priceStalenesThreshold);
console.log(" ✅ 阈值:", priceStalenesThreshold, "秒", `(${priceStalenesThreshold / 3600}小时)`);
// 设置keeper权限默认设置deployer为keeper
console.log("设置Keeper权限...");
await priceFeed.setKeeper(deployer.address, true);
@@ -121,6 +132,7 @@ async function main() {
console.log("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━");
console.log("✅ USDY vaults: YTVault, YTPoolManager");
console.log("✅ YTLPToken minter: YTPoolManager");
console.log("✅ YTLPToken poolManager: YTPoolManager (冷却时间保护)");
console.log("✅ YTVault poolManager: YTPoolManager");
console.log("✅ YTVault swapper: YTRewardRouter");
console.log("✅ YTPoolManager handler: YTRewardRouter");
@@ -145,6 +157,7 @@ async function main() {
permissions: {
usdyVaults: [vaultAddress, poolManagerAddress],
ytlpMinters: [poolManagerAddress],
ytlpPoolManager: poolManagerAddress,
vaultPoolManager: poolManagerAddress,
vaultSwappers: [routerAddress],
poolManagerHandlers: [routerAddress],