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

Make ERC20Wrapper.underlying variable private #4029

Merged
merged 9 commits into from
Feb 8, 2023

Conversation

kimanikelly
Copy link
Contributor

@kimanikelly kimanikelly commented Feb 5, 2023

Fixes #4026

Changes

  • Removed the public visibility from IERC20 immutable _underlying; and refactored it to include the _ due to linting errors.
  • Implemented the underlying() public view function to return the value of the _underlying variable.
  • Verified all unit tests pass including the ERC20Wrapper tests that reference the underlying function.

Visual Preview

Screen Shot 2023-02-04 at 9 35 43 AM

Screen Shot 2023-02-04 at 9 35 20 AM

PR Checklist

  • Tests
  • Documentation
  • Changeset entry (run npx changeset add)

Kimani Kelly and others added 3 commits February 4, 2023 09:12
Removed the public visibility from the underlying variable
Refactored the underlying variable to _underlying
Implemented the underlying function to return the value of the _underlying variable
Bugfix: ERC20Wrapper underlying variable is public
@changeset-bot
Copy link

changeset-bot bot commented Feb 5, 2023

🦋 Changeset detected

Latest commit: 55aa375

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
openzeppelin-solidity Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Amxx and others added 3 commits February 6, 2023 10:24
Included the private visibility to the _underlying variable
Pulled the latest changes
@kimanikelly
Copy link
Contributor Author

@Amxx Thanks, I went ahead and made the suggested changes

@Amxx Amxx changed the title Bugfix: ERC20Wrapper underlying variable is public Make ERC20Wrapper's storage variable private Feb 6, 2023
Copy link
Collaborator

@Amxx Amxx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Amxx Amxx requested a review from frangio February 6, 2023 14:38
@frangio
Copy link
Contributor

frangio commented Feb 7, 2023

@Amxx Should this function be virtual? If so, should we use the function instead of reading the variable? I honestly don't think anyone should override this, if it was an individual choice I wouldn't make it virtual.

Also, this is technically breaking, but I don't think it will affect anyone, we should still add a small note in the changelog.

@ernestognw
Copy link
Member

@Amxx Should this function be virtual? If so, should we use the function instead of reading the variable? I honestly don't think anyone should override this, if it was an individual choice I wouldn't make it virtual.

Whatever is decided, I think it'll apply to 3863 as well. Is that the case?

@Amxx
Copy link
Collaborator

Amxx commented Feb 7, 2023

Changing the value returned by this function would break everything. That is why its currently implemented with public immutable, because we don't expect any other usecase than "set and forget".

@frangio frangio changed the title Make ERC20Wrapper's storage variable private Make ERC20Wrapper.underlying variable private Feb 8, 2023
@frangio frangio merged commit 4d3e423 into OpenZeppelin:master Feb 8, 2023
@gitpoap-bot
Copy link

gitpoap-bot bot commented Feb 8, 2023

Congrats, your important contribution to this open-source project has earned you a GitPOAP!

GitPOAP: 2023 OpenZeppelin Contracts Contributor:

GitPOAP: 2023 OpenZeppelin Contracts Contributor GitPOAP Badge

Head to gitpoap.io & connect your GitHub account to mint!

Learn more about GitPOAPs here.

@kimanikelly
Copy link
Contributor Author

@Amxx @frangio @ernestognw I appreciate merging the changes and responding to the questions I had. I'm looking forward to contributing more in the future, thank you

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

Successfully merging this pull request may close these issues.

ERC20Wrapper underlying variable is public
4 participants