- 新增 ARB Sepolia + BNB Testnet 多链支持 - 添加 LendingPanel 借贷系统组件 - 添加 LendingAdminPanel 管理面板 - 添加 USDCPanel USDC 操作组件 - 添加 HoldersPanel 持有人信息组件 - 添加 AutoTestPanel 自动化测试组件 - 重构 LP 组件为模块化结构 (LP/) - 添加多个调试和测试脚本 - 修复 USDC 精度动态配置 - 优化合约配置支持多链切换 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
83 lines
2.4 KiB
JavaScript
83 lines
2.4 KiB
JavaScript
import { createPublicClient, http, getAddress, parseAbi, encodeFunctionData } from 'viem'
|
|
import { arbitrumSepolia } from 'viem/chains'
|
|
|
|
const client = createPublicClient({
|
|
chain: arbitrumSepolia,
|
|
transport: http('https://sepolia-rollup.arbitrum.io/rpc')
|
|
})
|
|
|
|
const LENDING_PROXY = getAddress('0xCb4E7B1069F6C26A1c27523ce4c8dfD884552d1D')
|
|
// A random user address or the deployer to test view functions
|
|
const USER = getAddress('0xa013422A5918CD099C63c8CC35283EACa99a705d')
|
|
|
|
async function main() {
|
|
console.log('Checking Lending Proxy View Functions...')
|
|
|
|
// Check borrowBalanceOf
|
|
try {
|
|
const data = encodeFunctionData({
|
|
abi: parseAbi(['function borrowBalanceOf(address) view returns (uint256)']),
|
|
functionName: 'borrowBalanceOf',
|
|
args: [USER]
|
|
})
|
|
const result = await client.call({
|
|
to: LENDING_PROXY,
|
|
data
|
|
})
|
|
console.log(`✅ borrowBalanceOf exists. Result: ${result.data}`)
|
|
} catch (e) {
|
|
console.log(`❌ borrowBalanceOf failed: ${e.message.slice(0, 100)}...`)
|
|
}
|
|
|
|
// Check getBorrowBalance
|
|
try {
|
|
const data = encodeFunctionData({
|
|
abi: parseAbi(['function getBorrowBalance(address) view returns (uint256)']),
|
|
functionName: 'getBorrowBalance',
|
|
args: [USER]
|
|
})
|
|
const result = await client.call({
|
|
to: LENDING_PROXY,
|
|
data
|
|
})
|
|
console.log(`✅ getBorrowBalance exists. Result: ${result.data}`)
|
|
} catch (e) {
|
|
console.log(`❌ getBorrowBalance failed: ${e.message.slice(0, 100)}...`)
|
|
}
|
|
|
|
// Check getTotalSupply
|
|
try {
|
|
const data = encodeFunctionData({
|
|
abi: parseAbi(['function getTotalSupply() view returns (uint256)']),
|
|
functionName: 'getTotalSupply',
|
|
args: []
|
|
})
|
|
const result = await client.call({
|
|
to: LENDING_PROXY,
|
|
data
|
|
})
|
|
console.log(`✅ getTotalSupply exists. Result: ${result.data}`)
|
|
} catch (e) {
|
|
console.log(`❌ getTotalSupply failed: ${e.message.slice(0, 100)}...`)
|
|
}
|
|
|
|
// Check getTotalLiquidity
|
|
try {
|
|
const data = encodeFunctionData({
|
|
abi: parseAbi(['function getTotalLiquidity() view returns (uint256)']),
|
|
functionName: 'getTotalLiquidity',
|
|
args: []
|
|
})
|
|
const result = await client.call({
|
|
to: LENDING_PROXY,
|
|
data
|
|
})
|
|
console.log(`✅ getTotalLiquidity exists. Result: ${result.data}`)
|
|
} catch (e) {
|
|
console.log(`❌ getTotalLiquidity failed: ${e.message.slice(0, 100)}...`)
|
|
}
|
|
|
|
}
|
|
|
|
main()
|