feat: 添加多链支持和 Lending 借贷系统
- 新增 ARB Sepolia + BNB Testnet 多链支持 - 添加 LendingPanel 借贷系统组件 - 添加 LendingAdminPanel 管理面板 - 添加 USDCPanel USDC 操作组件 - 添加 HoldersPanel 持有人信息组件 - 添加 AutoTestPanel 自动化测试组件 - 重构 LP 组件为模块化结构 (LP/) - 添加多个调试和测试脚本 - 修复 USDC 精度动态配置 - 优化合约配置支持多链切换 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
78
frontend/scripts/check-configurator-setup.js
Normal file
78
frontend/scripts/check-configurator-setup.js
Normal file
@@ -0,0 +1,78 @@
|
||||
import { createPublicClient, http, parseAbi } from 'viem';
|
||||
import { arbitrumSepolia } from 'viem/chains';
|
||||
|
||||
const CONFIGURATOR_ADDRESS = '0x488409CE9A3Fcd8EbD373dCb7e025cF8AB96fcdc';
|
||||
const LENDING_PROXY = '0xCb4E7B1069F6C26A1c27523ce4c8dfD884552d1D';
|
||||
|
||||
// 扩展的 ABI,包含可能的其他函数
|
||||
const CONFIGURATOR_ABI = parseAbi([
|
||||
'function owner() view returns (address)',
|
||||
'function lending() view returns (address)',
|
||||
'function lendingContract() view returns (address)',
|
||||
'function getLending() view returns (address)',
|
||||
'function setLending(address) external',
|
||||
'function initialize(address) external',
|
||||
'function collateralConfigs(address) view returns (bool, uint256, uint256, uint256)'
|
||||
]);
|
||||
|
||||
const publicClient = createPublicClient({
|
||||
chain: arbitrumSepolia,
|
||||
transport: http('https://sepolia-rollup.arbitrum.io/rpc')
|
||||
});
|
||||
|
||||
async function checkSetup() {
|
||||
console.log('🔍 检查 Configurator 设置\n');
|
||||
|
||||
// 尝试读取lending地址(可能有不同的函数名)
|
||||
const possibleGetters = ['lending', 'lendingContract', 'getLending'];
|
||||
|
||||
for (const getter of possibleGetters) {
|
||||
try {
|
||||
console.log(`尝试调用 ${getter}()...`);
|
||||
const lendingAddr = await publicClient.readContract({
|
||||
address: CONFIGURATOR_ADDRESS,
|
||||
abi: CONFIGURATOR_ABI,
|
||||
functionName: getter
|
||||
});
|
||||
console.log(`✅ 找到! ${getter}() = ${lendingAddr}`);
|
||||
console.log(` 期望地址: ${LENDING_PROXY}`);
|
||||
console.log(` 匹配: ${lendingAddr.toLowerCase() === LENDING_PROXY.toLowerCase() ? '✅' : '❌'}\n`);
|
||||
|
||||
if (lendingAddr.toLowerCase() !== LENDING_PROXY.toLowerCase()) {
|
||||
console.log('⚠️ 警告: Lending 地址不匹配!');
|
||||
console.log('💡 可能需要调用 setLending() 来设置正确的地址\n');
|
||||
}
|
||||
|
||||
return;
|
||||
} catch (error) {
|
||||
console.log(` ❌ ${getter}() 不存在或调用失败\n`);
|
||||
}
|
||||
}
|
||||
|
||||
console.log('💡 建议:');
|
||||
console.log(' 1. Configurator 可能需要先通过 initialize() 或 setLending() 设置 Lending 合约地址');
|
||||
console.log(' 2. 检查合约源码或部署脚本中的初始化步骤');
|
||||
console.log(' 3. 可能需要 Lending owner 先在 Configurator 中注册\n');
|
||||
|
||||
// 检查是否有其他状态变量
|
||||
console.log('🔍 尝试读取其他可能的状态...\n');
|
||||
|
||||
// 尝试直接读取存储槽
|
||||
try {
|
||||
// Slot 0 通常是第一个状态变量
|
||||
const slot0 = await publicClient.getStorageAt({
|
||||
address: CONFIGURATOR_ADDRESS,
|
||||
slot: '0x0'
|
||||
});
|
||||
console.log('Storage Slot 0:', slot0);
|
||||
|
||||
if (slot0 && slot0 !== '0x' + '0'.repeat(64)) {
|
||||
const addr = '0x' + slot0.slice(-40);
|
||||
console.log('可能的地址值:', addr);
|
||||
}
|
||||
} catch (error) {
|
||||
console.log('无法读取存储槽');
|
||||
}
|
||||
}
|
||||
|
||||
checkSetup();
|
||||
Reference in New Issue
Block a user