ethereum - 如何从合同中使用 app.compound.finance repayBehalf?
问题描述
我无法偿还;repayAmount 始终为 0: etherscan
这是我手动完成的网站:etherscan
我什至无法偿还借款
symbol ='cETH'
abi_url = "https://raw.githubusercontent.com/compound-finance/compound-protocol/master/networks/kovan-abi.json"
kovan_json = "https://raw.githubusercontent.com/compound-finance/compound-protocol/master/networks/kovan.json"
abi = requests.get(abi_url).json()["Maximillion"]
contract_address = requests.get(kovan_json).json()['Maximillion']['address']
compound_token_contract = w3.eth.contract(abi=abi, address=Web3.toChecksumAddress(contract_address))
nonce = w3.eth.getTransactionCount(ETH_ADDRESS)
tx = compound_token_contract.functions.repayBehalf( ETH_ADDRESS ).buildTransaction({
'chainId': 42,
'gas': 500000,
'gasPrice': w3.toWei('20', 'gwei'),
'nonce': nonce,
# 'repayAmount ': "-1"
})
signed_txn = w3.eth.account.sign_transaction(tx, ETH_ACCT_KEY)
w3.eth.sendRawTransaction(signed_txn.rawTransaction)
这是交易创建者,我被卡住了
contract's .sol
在这里归档
解决方案
# 'repayAmount ': "-1"
我通过更改线路来修复它"value": 1
推荐阅读
- c# - 如何解决 EPPlus .Net 库生成的 Excel 打开错误
- python - H5py 层 - 在使用自定义 keras 层时无法在第一个时代之后创建链接(“名称已存在”)
- typescript - 三元运算符和 Vue 过滤器
- swift - 如何调整警报控制器上显示的图像大小?
- mysql - 根据其他列值检查约束
- javascript - 如何通过查询过滤器在mongodb中搜索
- javascript - 从 javascript 数组生成动态 html 卡片
- spring - 来自 application.yml 的 Logback 目标配置
- postgresql - JSONB 之间的区别 ->> 和 #>>
- javascript - 如果小数接近,Tesseract 无法识别大数