CRYPTO NEWS

Ethereum Users Flock to Optimism for Aave Liquidity Mining Launch

A new liquidity mining program on Aave has helped push the total value locked in Optimism above $1.5 billion. Optimism Launches Liquidity Mining on Aave Optimism has launched another round…

How to decode Input data in web3py

This is my script: pcsRouter = web3.toChecksumAddress(‘0x10ED43C718714eb63d5aA57B78B54704E256024E’) pcsAbi = json.loads(‘pcsRouterAbi’) pcsContract = web3.eth.contract(address=pcsRouter, abi=pcsAbi) def handle_event(event): #print(Web3.toJSON(event)) try: getTrans = Web3.toJSON(event).strip(‘"’) #print(web3.eth.get_transaction(getTrans)) trans = web3.eth.get_transaction(getTrans) #print(trans[‘input’]) if trans[‘to’] == pcsRouter: func_obj, func_params = pcsContract.functions.decode_function_input(getTrans[‘input’]) print(func_obj, func_params) else: print(‘nothing’) except Exception as e: print(f’error occurred: {e}’) and I want to decode the Input data, but I::Listen

This is my script:

pcsRouter = web3.toChecksumAddress('0x10ED43C718714eb63d5aA57B78B54704E256024E') pcsAbi = json.loads('pcsRouterAbi')  pcsContract = web3.eth.contract(address=pcsRouter, abi=pcsAbi)   def handle_event(event):     #print(Web3.toJSON(event))     try:         getTrans = Web3.toJSON(event).strip('"')         #print(web3.eth.get_transaction(getTrans))         trans = web3.eth.get_transaction(getTrans)         #print(trans['input'])         if trans['to'] == pcsRouter:             func_obj, func_params = pcsContract.functions.decode_function_input(getTrans['input'])             print(func_obj, func_params)         else:             print('nothing')              except Exception as e:         print(f'error occurred: {e}') 

and I want to decode the Input data, but I keep getting this error:

error occurred: ("The function 'decode_function_input' was not found in this contract's abi. ", 'Are you sure you provided the correct contract abi?') 

I have spend some time on google and this exact question has been answered on here: Decoding Input Data

And I followed the same exact steps but im still not able to decode the input data in order to get this output:

{   'amountOut': 20000000000000000000,   'amountInMax': 4199668209374381292,   'path': ['0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', '0x3c9d6c1C73b31c837832c72E04D3152f051fc1A9'],   'to': '0x9A7eD54b8c2c5816C1800476F5111A1e88657502',   'deadline': 1624239679 } 

So what am I doing wrong?

Ethereum Users Flock to Optimism for Aave Liquidity Mining Launch

Shopping cart
There are no products in the cart!
Continue shopping
0