fix contract
This commit is contained in:
@@ -79,6 +79,13 @@ async function main() {
|
||||
console.log("✅ LendingPriceFeed Implementation:", lendingPriceFeedImplAddress);
|
||||
deployments.lendingPriceFeedImpl = lendingPriceFeedImplAddress;
|
||||
|
||||
// 根据网络设置价格过期阈值(必须在验证价格之前设置)
|
||||
const isTestnet = network.chainId === 97n || network.chainId === 11155111n; // BSC测试网或Sepolia
|
||||
const priceStalenesThreshold = isTestnet ? 86400 : 3600; // 测试网24小时,主网1小时
|
||||
const setThresholdTx = await lendingPriceFeed.setPriceStalenessThreshold(priceStalenesThreshold);
|
||||
await setThresholdTx.wait(); // 等待交易确认
|
||||
console.log("✅ 价格过期阈值已设置:", priceStalenesThreshold, "秒", `(${priceStalenesThreshold / 3600}小时)`);
|
||||
|
||||
// 验证价格获取
|
||||
const usdcPrice = await lendingPriceFeed.getPrice(USDC_ADDRESS);
|
||||
console.log("✅ USDC 价格 (1e30 精度):", usdcPrice.toString());
|
||||
|
||||
Reference in New Issue
Block a user