Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to calculate "parameter" for "trigger_constant_contract" method? #104

Closed
reza-khalafi opened this issue Aug 29, 2023 · 1 comment
Closed

Comments

@reza-khalafi
Copy link

I need to calculate energy_used so use tron.trigger_constant_contract like this:

    result = tron.trigger_constant_contract(
        owner_address="TQYbVpBqboaQu4rc4bLuD9VUqNAAAAAAA",
        contract_address="TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t",
        function_selector="transfer (address, uint256)",
        parameter="" # ?
    )
    print(result)

And for calculate parameter i used this:

    with open("abi/trc20_abi.json") as f:
        info_json = json.load(f) # from tronscan
    bytecode = '60806040526000...' # from tronscan
    cntr = Contract(name="TetherToken", bytecode=bytecode, abi=info_json)
    parameter = cntr.constructor.encode_parameter("TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t", 18) # like tronpy document
    print(parameter)

So get this error: TypeError: wrong number of arguments, require 4 got 2

What is 18 in this method? What is the problem? Is there better way?

@MrNaif2018
Copy link
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants