Skip to content

use nemultiSwap,链上有交易,交易失败 #37

@brant9527

Description

@brant9527

multiSwap这个方法
for index, info in enumerate(swaps_list):
swaps.append(dict(
poolIdx=int(info['poolIdx']),
base=self.w3.to_checksum_address(info['base']),
quote=self.w3.to_checksum_address(info['quote']),
isBuy=info['isBuy']
))
if asset_in_address.lower() == wbear_address.lower():
swaps[0]['assetIn'] = zero_address
logger.debug(f'amount_in:{amount_in}')
minOut=1

    txn = self.bex_contract.functions.multiSwap(_steps=swaps,_amount=amount_in,_minOut=minOut).build_transaction(
        {'gas': 500000 + random.randint(1, 10000), 'value': amount_in if asset_in_address == wbear_address else 0,
         'gasPrice': int(self.w3.eth.gas_price * 6), 'nonce': self.get_nonce()})

    signed_txn = self.w3.eth.account.sign_transaction(txn, private_key=self.private_key)
    
    order_hash = self.w3.eth.send_raw_transaction(signed_txn.raw_transaction)
    print(order_hash.hex())
    return order_hash.hex()
  abi里面unit128 不支持,所以type类型我改为了int类型
  
  失败的加油hash:0xf1eaA7e5609cBff10b9488d702A160F18C161A35
  不知道哪里设置错了,帮忙指导下

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions