import { createPublicClient, http, getAddress } from 'viem' import { arbitrumSepolia } from 'viem/chains' const client = createPublicClient({ chain: arbitrumSepolia, transport: http('https://api.zan.top/node/v1/arb/sepolia/baf84c429d284bb5b676cb8c9ca21c07') }) const LENDING_PROXY = getAddress('0xCb4E7B1069F6C26A1c27523ce4c8dfD884552d1D') const YT_A = getAddress('0x97204190B35D9895a7a47aa7BaC61ac08De3cF05') const USER = getAddress('0xa013422A5918CD099C63c8CC35283EACa99a705d') const LENDING_ABI = [ { inputs: [ { internalType: 'address', name: '_user', type: 'address' }, { internalType: 'address', name: '_collateralAsset', type: 'address' } ], name: 'getUserCollateral', outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], stateMutability: 'view', type: 'function' } ] async function main() { console.log('\n检查抵押品余额...\n') console.log('用户:', USER) console.log('抵押品:', YT_A) try { const collateralBalance = await client.readContract({ address: LENDING_PROXY, abi: LENDING_ABI, functionName: 'getUserCollateral', args: [USER, YT_A] }) console.log('\n✓ 抵押品余额:', Number(collateralBalance) / 1e18, 'YT-A') if (collateralBalance > 0n) { console.log('\n成功!代币已存入合约作为抵押品。') } else { console.log('\n警告:抵押品余额为 0,但钱包代币已被扣除。') console.log('可能原因:') console.log('1. 交易失败但代币被锁在某处') console.log('2. 函数调用错误,需要检查交易哈希') } } catch (error) { console.error('\n✗ 读取失败:', error.message) } } main()