A Python library for interacting with Ethereum blockchain
Overall
score
88%
Evaluation — 88%
↑ 1.01xAgent success when using this tile
Build a utility that calls specific versions of overloaded contract functions using function signatures.
Smart contracts can have multiple functions with the same name but different parameters (overloading). For example, a contract might have both getValue() and getValue(uint256). To call the correct version, you must specify the complete function signature.
Create a Python function call_contract_function that:
The function signature should be:
def call_contract_function(w3, contract_address, abi, function_signature, *args):
"""
Call a contract function by its signature.
Args:
w3: Web3 instance
contract_address: Contract address (string)
abi: Contract ABI (list)
function_signature: Function signature like "getValue(uint256)"
*args: Arguments to pass to the function
Returns:
The result from the contract function call
"""getValue() and getValue(uint256), calling the utility with signature "getValue()" should invoke the parameterless version @testgetValue() and getValue(uint256), calling the utility with signature "getValue(uint256)" with argument 42 should invoke the parameterized version and return the result @testProvides Ethereum blockchain interaction capabilities including contract function resolution by signature.
@generates
Install with Tessl CLI
npx tessl i tessl/pypi-web3docs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10