iexbase/tron-api-python

Receiving revert response from contract trigger

Closed this issue · 4 comments

I am running below code to trigger TronBet contract

parameters=[{'type': 'uint256', 'value': rollvalue}, {'type': 'uint256', 'value': direction}]#, {'type': 'uint64', 'value': "roll"}] parameters=[{"value":rollvalue,"type":"uint256"},{"value":direction,"type":"uint256"}] tx=tron.transaction_builder.trigger_smart_contract('TEEXEWrkMFKapSMJ6mErg39ELFKDqEs6w3','GoodLuck',fee_limit,bet_value,parameters)#,'TQR27jXR4dHdDtjE63MnnUQvecK97rop2y') #print(tx) #tx=tx['transaction'] tx=tron.trx.sign(tx)#,True) tron.trx.broadcast(tx)

Everything goes fine but contract is not triggered. When I enquire trx then I get below info

{'ret': [{'contractRet': 'REVERT'}], 'signature': ['0219801893a402337d882c09e598780579d9c21a6ab1d7cdd21ca452e50fbd884830f2892998bdfab2360240b3007aaf6cd29ad76b2005886d547d307f36a8bf1b'], 'txID': '32308a59ebd4b6442fb49f1914e6e5c7636fb0144eefd79f0e75f981f9ab159d', 'raw_data': {'contract': [{'parameter': {'value': {'data': '16bd160c00000000000000000000000000000000000000000000000000000000000000320000000000000000000000000000000000000000000000000000000000000000', 'owner_address': '419e737d5db19beafc2a9a813211cc73add2d3a872', 'contract_address': '412ec5f63da00583085d4c2c5e8ec3c8d17bde5e28', 'call_value': 10000000}, 'type_url': 'type.googleapis.com/protocol.TriggerSmartContract'}, 'type': 'TriggerSmartContract'}], 'ref_block_bytes': 'cf50', 'ref_block_hash': 'c25f1caca6eb80d0', 'expiration': 1546335174000, 'fee_limit': 600000, 'timestamp': 1546335116934}}

So it is reverted. Code failed to trigger the contract.

Please check. What is wrong and how to fix it

is it resolved or what

Closed, because everything works. We tested

Hello serderovsh,

I upgraded all the installations including tronapi but I still see the same problem. That transactions are being reverted. pls see latest as done just now
{'ret': [{'contractRet': 'REVERT'}], 'signature': ['8e7742b4ad0645f53a5c8002edd5460d86b1e194741a661651f0b63fec994c6f2bc8fb7c24be18b68958786874086a01a46ef56ece9aadb19bdf621c3c2b495c1c'], 'txID': 'a8091842b1a0c7eeca9c41f9579669ab2e7ee5901ba6e0d6d635d40ffffb3565', 'raw_data': {'contract': [{'parameter': {'value': {'data': '16bd160c00000000000000000000000000000000000000000000000000000000000000320000000000000000000000000000000000000000000000000000000000000000', 'owner_address': '419e737d5db19beafc2a9a813211cc73add2d3a872', 'contract_address': '412ec5f63da00583085d4c2c5e8ec3c8d17bde5e28', 'call_value': 10000000}, 'type_url': 'type.googleapis.com/protocol.TriggerSmartContract'}, 'type': 'TriggerSmartContract'}], 'ref_block_bytes': '4bc6', 'ref_block_hash': '3ef538e20d4c9c06', 'expiration': 1548241557000, 'fee_limit': 600000, 'timestamp': 1548241501491}}

could you please check to do it with tronbet or dice. I am getting this error for both of them I tried.

I appreciate all the help you provide.

Thanks and Regards,

The reason could be incorrect values of original_energy_limit and call_value.
I calculated original_energy_value by the below formula, which is described in detail in Tron documents:
if​ F > LR
let​ M = min(E+T
C, LR)
else
let​ M = E+T
C

and set call_value to zero.