Skip to content

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

@fubuloubu

Description

@fubuloubu

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

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions