- 新增 ARB Sepolia + BNB Testnet 多链支持 - 添加 LendingPanel 借贷系统组件 - 添加 LendingAdminPanel 管理面板 - 添加 USDCPanel USDC 操作组件 - 添加 HoldersPanel 持有人信息组件 - 添加 AutoTestPanel 自动化测试组件 - 重构 LP 组件为模块化结构 (LP/) - 添加多个调试和测试脚本 - 修复 USDC 精度动态配置 - 优化合约配置支持多链切换 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
34 lines
1.5 KiB
JavaScript
34 lines
1.5 KiB
JavaScript
import { decodeAbiParameters, parseAbiParameters } from 'viem';
|
|
|
|
// 从错误日志中的 data 字段
|
|
const txData = '0x5fcbde4700000000000000000000000097204190b35d9895a7a47aa7bac61ac08de3cf050000000000000000000000000000000000000000000000000000000000001d4c000000000000000000000000000000000000000000000000000000000000213400000000000000000000000000000000000000000000000000000000000003e8';
|
|
|
|
// 函数选择器 (前4字节)
|
|
const selector = txData.slice(0, 10);
|
|
console.log('函数选择器:', selector);
|
|
|
|
// 参数数据 (从第10个字符开始)
|
|
const paramData = '0x' + txData.slice(10);
|
|
|
|
try {
|
|
// 解码参数
|
|
const decoded = decodeAbiParameters(
|
|
parseAbiParameters('address, uint256, uint256, uint256'),
|
|
paramData
|
|
);
|
|
|
|
console.log('\n解码的参数:');
|
|
console.log(' _asset (YT-A地址):', decoded[0]);
|
|
console.log(' _collateralFactor:', decoded[1].toString(), '(即', Number(decoded[1]) / 100, '%)');
|
|
console.log(' _liquidationThreshold:', decoded[2].toString(), '(即', Number(decoded[2]) / 100, '%)');
|
|
console.log(' _liquidationBonus:', decoded[3].toString(), '(即', Number(decoded[3]) / 100, '%)');
|
|
|
|
console.log('\n✅ 参数解码成功,看起来都是正常的值');
|
|
console.log('💡 问题可能在于:');
|
|
console.log(' 1. 合约内部的require条件未满足');
|
|
console.log(' 2. 可能需要先调用其他初始化函数');
|
|
console.log(' 3. 可能Lending合约需要先设置到Configurator中');
|
|
} catch (error) {
|
|
console.error('解码失败:', error);
|
|
}
|