Skip to content

All state variables should be private #1174

@come-maiz

Description

@come-maiz

Solidity adds public getters to public state variables. This is kind of magical and dark, and could lead to mistakes.

We should be more explicit on everything we do, to make the code clearer and easier to review. So let's get rid of the automatic getters making all the public state variables private. If the variable has to be accessed from outside of the contract, we should add a getter function that should be either internal or public, depending on how the contracat is designed.

This gives us an extra benefit because the state variables will be implementation details and this allows us to make some changes without modifying the public API of the contract.

Metadata

Metadata

Assignees

Labels

breaking changeChanges that break backwards compatibility of the public API.contractsSmart contract code.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions