对于以下帐户,我尝试了确切的金额,少一点,高一点,但每次都出现相同的错误(03)
{
"address": "0xd122064e872c6627a2e6365366c41ca4997a6132",
"health": "0.0885893766150666024272056949244717858376155937919597090083539279000428390406",
"total_borrow_value_in_eth": "0.5052165581572603744560807657",
"total_collateral_value_in_eth": "0.04475681994276123835834344540",
"tokens": [
{
"address": "0x41b5844f4680a8c38fbb695b7f9cfd1f64474a72",
"borrow_balance_underlying": {
"value": "0.5052165581572604"
},
"lifetime_borrow_interest_accrued": {
"value": "0.1354379817811201"
},
"lifetime_supply_interest_accrued": {
"value": "0.0"
},
"safe_withdraw_amount_underlying": {
"value": "0"
},
"supply_balance_underlying": {
"value": "0.0"
},
"symbol": "cETH"
}
]
}
我从requests.get('https://api.compound.finance/api/v2/account?network=kovan&page_size=100').json()
我什至尝试使用您自己的功能:
abi = requests.get("https://raw.githubusercontent.com/compound-finance/compound-protocol/master/networks/kovan-abi.json").json()
tokens = requests.get("https://raw.githubusercontent.com/compound-finance/compound-protocol/master/networks/kovan.json").json()
contract_address = tokens['cTokens']['cETH']['address']
compound_token_contract = w3.eth.contract(abi=abi["cETH")], address=Web3.toChecksumAddress(contract_address))
compound_token_contract.functions.borrowBalanceStored(w3.toChecksumAddress(borrower)).call()
compound_token_contract.functions.borrowBalanceCurrent(w3.toChecksumAddress(borrower)).call()
用例:
tx = compound_token_contract.functions.liquidateBorrow('0xd122064e872C6627a2E6365366C41cA4997a6132', '0x41B5844f4680a8C38fBb695b7F9CFd1F64474a72').buildTransaction({
'chainId': 42,
'gas': 500000,
'gasPrice': w3.toWei('20', 'gwei'),
'nonce': nonce,
'value': w3.toWei("0.5052165581572603744560807657", 'ether')
})
https://kovan.etherscan.io/tx/0x1b0f3728075e86c45e015d9dd95fd8dc98b828e75db06055da7758c76c9b8be3 账户持有人可能不让我清算他的资产或类似的东西吗?因为我记得我是在几天前在 etherscan.io 上找到的一些随机帐户上做的