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

VIP: Support ABI State Mutability Fields in Interface Definitions #2042

Closed
fubuloubu opened this issue Jun 25, 2020 · 2 comments · Fixed by #2054
Closed

VIP: Support ABI State Mutability Fields in Interface Definitions #2042

fubuloubu opened this issue Jun 25, 2020 · 2 comments · Fixed by #2054
Assignees
Labels
VIP: Approved VIP Approved

Comments

@fubuloubu
Copy link
Member

fubuloubu commented Jun 25, 2020

Simple Summary

Support all ABI "stateMutability" fields in contract interface definitions

Motivation

The ABI standard currently has 4 possibilities for "State Mutability", a field that is supposed to describe the degree of statefulness/mutability of a contract method. The four options are:

  • pure (Does not view or modify state, or accept Ether. Called using STATICCALL.)
  • view (Does not modify state or accept Ether, but can view state. Called using STATICCALL.)
  • nonpayable (Does not accept Ether, but can modify and/or view state. Called using CALL.)
  • pure (Requires sending Ether, and can optional modify and/or view state. Called using CALL.)

Currently, when you import a JSON or Vyper interface from a file, these attributes are able to be specified, but they do not perform additional checks (such as requiring @payable or value=... for payable) when using implements or making a call. This VIP would change how interfaces are specified to closely mimic how defining contract ABIs are performed.

Specification

How this would look is like the following:

interface MyInterface:
    def a(): pure
    def b(): view
    def c(): nonpayable
    def d(): payable

The current keywords, constant and modifying would be changed according to: constant -> view (or pure), and modifying -> nonpayable (or payable)

Backwards Compatibility

Backwards incompatibility because of name change, and update to ABI output

Dependencies

Depends on #2040 and #2041 (for consistency)

References

Copyright

Copyright and related rights waived via CC0

@fubuloubu fubuloubu changed the title VIP: Suport ABI State Mutability Fields VIP: Support ABI State Mutability Fields in Interface Definitions Jun 25, 2020
@fubuloubu fubuloubu added this to the v0.2 Release milestone Jun 26, 2020
@fubuloubu fubuloubu self-assigned this Jun 26, 2020
@fubuloubu
Copy link
Member Author

Partially implemented in #2049

@fubuloubu
Copy link
Member Author

Also, as of resolving this issue, update ABI output to use stateMutability exclusively

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

Successfully merging a pull request may close this issue.

2 participants