- 新增 ARB Sepolia + BNB Testnet 多链支持 - 添加 LendingPanel 借贷系统组件 - 添加 LendingAdminPanel 管理面板 - 添加 USDCPanel USDC 操作组件 - 添加 HoldersPanel 持有人信息组件 - 添加 AutoTestPanel 自动化测试组件 - 重构 LP 组件为模块化结构 (LP/) - 添加多个调试和测试脚本 - 修复 USDC 精度动态配置 - 优化合约配置支持多链切换 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
29 lines
687 B
JavaScript
29 lines
687 B
JavaScript
import { keccak256, toHex } from 'viem'
|
|
|
|
// 计算函数选择器
|
|
function getFunctionSelector(signature) {
|
|
const hash = keccak256(toHex(signature))
|
|
return hash.slice(0, 10) // 前4字节
|
|
}
|
|
|
|
console.log('\n计算函数选择器...\n')
|
|
|
|
const signatures = [
|
|
'deposit(address,uint256)',
|
|
'supplyCollateral(address,uint256)',
|
|
'supply(address,uint256)',
|
|
'supplyTo(address,address,uint256)'
|
|
]
|
|
|
|
signatures.forEach(sig => {
|
|
const selector = getFunctionSelector(sig)
|
|
console.log(`${sig}`)
|
|
console.log(` 选择器: ${selector}`)
|
|
if (selector === '0x47e7ef24') {
|
|
console.log(' ✓ 匹配!')
|
|
}
|
|
console.log()
|
|
})
|
|
|
|
console.log('错误消息中的选择器: 0x47e7ef24')
|