You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Goerli测试网Uniswap流动性铸造失败问题排查

Uniswap流动性铸造问题排查

我想用Python在Goerli测试网铸造Uniswap流动性:

  • 在分叉主网环境下,使用uniswap-python库的uniswap.mint_liquidity()命令可正常运行,但切换到Goerli测试网后执行失败。
  • 转用web3.py实现:先执行授权操作(代码如下),该步骤成功;但调用NFT Position Manager的mint方法时失败,且该问题在分叉主网环境中同样存在。经排查,报错行是nft_manager.functions.mint(mint_params).transact()。

授权代码(执行成功)

approval_data = token_0_instance.encodeABI(fn_name='approve', args=[nft_manager.address, amt])
transaction = {...}
signed_transaction = w3.eth.account.sign_transaction(transaction, pk)
tx_hash = w3.eth.send_raw_transaction(signed_transaction.rawTransaction) 

失败的mint代码

mint_params = (
...tuple of mint_params...
)

transaction = {
    'nonce': w3.eth.get_transaction_count(account),
    'to': nft_manager.address, 
    'data': nft_manager.functions.mint(mint_params).transact(),  
    'gas': gas,  
    'gasPrice': w3.to_wei('500', 'gwei'), 
}

signed_transaction = w3.eth.account.sign_transaction(transaction, pk)
tx_hash = w3.eth.send_raw_transaction(signed_transaction.rawTransaction) 

请问我的思路是否存在错误?

内容的提问来源于stack exchange,提问作者ashertob

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.12 23:42:36