Open bout3fiddy opened 1 month ago
this seems like a bit of a niche use case. i think it might be more generally useful for users if the function were boa.from_sigs(list[str]) -> ABIContractFactory
which takes a list of signatures instead of a single function, as it's a bit odd to think of a smart contract with a full interface as consisting of a single function.
also, ABIContractFactory.from_sigs()
might be better, since it's a bit of a niche use case we don't need to pollute the global boa namespace.
What I did
Enables:
This way, I don't need to store a long abi file, or write a complicated json dict and let vyper handle it for me underneath.
How I did it
Added method
from_fn_sig
to ABIContractFactory class, thus extending it's scope to beyond just providing a list of dict.How to verify it
Run test: https://github.com/bout3fiddy/titanoboa/blob/ac38a8b79a2467b8c68bbe42b38fd21e072a1caa/tests/integration/fork/test_abi_contract.py#L43
Description for the changelog
Adds
boa.loads_fn_sig("def foo() -> uint256: view")
-> contract object.Cute Animal Picture