- 新增 ARB Sepolia + BNB Testnet 多链支持 - 添加 LendingPanel 借贷系统组件 - 添加 LendingAdminPanel 管理面板 - 添加 USDCPanel USDC 操作组件 - 添加 HoldersPanel 持有人信息组件 - 添加 AutoTestPanel 自动化测试组件 - 重构 LP 组件为模块化结构 (LP/) - 添加多个调试和测试脚本 - 修复 USDC 精度动态配置 - 优化合约配置支持多链切换 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
42 lines
1.5 KiB
JavaScript
42 lines
1.5 KiB
JavaScript
import { createPublicClient, http } from 'viem';
|
||
import { arbitrumSepolia } from 'viem/chains';
|
||
|
||
const CONFIGURATOR_ADDRESS = '0x488409CE9A3Fcd8EbD373dCb7e025cF8AB96fcdc';
|
||
|
||
// ERC-1967 标准存储槽
|
||
const IMPLEMENTATION_SLOT = '0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc';
|
||
|
||
const publicClient = createPublicClient({
|
||
chain: arbitrumSepolia,
|
||
transport: http('https://sepolia-rollup.arbitrum.io/rpc')
|
||
});
|
||
|
||
async function getImplementation() {
|
||
console.log('🔍 查找代理合约的实现地址\n');
|
||
|
||
try {
|
||
// 读取 ERC-1967 实现槽
|
||
const slot = await publicClient.getStorageAt({
|
||
address: CONFIGURATOR_ADDRESS,
|
||
slot: IMPLEMENTATION_SLOT
|
||
});
|
||
|
||
if (slot && slot !== '0x' + '0'.repeat(64)) {
|
||
// 从存储槽中提取地址(去掉前面的0)
|
||
const implementationAddress = '0x' + slot.slice(-40);
|
||
console.log('✅ 找到实现合约:');
|
||
console.log(` 代理合约 (Configurator): ${CONFIGURATOR_ADDRESS}`);
|
||
console.log(` 实现合约 (Implementation): ${implementationAddress}`);
|
||
console.log(`\n📊 查看实现合约源码:`);
|
||
console.log(` https://sepolia.arbiscan.io/address/${implementationAddress}#code`);
|
||
console.log(`\n💡 提示: 需要使用实现合约的 ABI,但调用代理合约的地址`);
|
||
} else {
|
||
console.log('❌ 未找到实现地址');
|
||
}
|
||
} catch (error) {
|
||
console.error('❌ 错误:', error.message);
|
||
}
|
||
}
|
||
|
||
getImplementation();
|