Simple Summary
Add a method_id member to interface functions:
from vyper.interfaces import ERC20
m: Bytes[4] = ERC20.transfer.method_id
Motivation
Currently, when using raw_call we have to generate the method ID from a string of the function selector, using the method_id builtin. Adding method_id as a member to interfaces is less error-prone and arguably more readable.
Specification
<INTERFACE>.<FUNCTION>.method_id
The member is accessible only from the primitive type:
# valid, accessing via the primitive
m: Bytes[4] = ERC20.transfer.method_id
# not valid, trying to access from a defined type
m: Bytes[4] = ERC20(_addr).transfer.method_id
Backwards Compatibility
Not a breaking change.
Copyright
Copyright and related rights waived via CC0
Simple Summary
Add a
method_idmember to interface functions:Motivation
Currently, when using
raw_callwe have to generate the method ID from a string of the function selector, using themethod_idbuiltin. Addingmethod_idas a member to interfaces is less error-prone and arguably more readable.Specification
The member is accessible only from the primitive type:
Backwards Compatibility
Not a breaking change.
Copyright
Copyright and related rights waived via CC0