Files
Heyue_test/frontend/scripts/get-proxy-implementation.js
Sofio 5cb64f881e 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>
2026-01-26 23:32:29 +08:00

42 lines
1.5 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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();