ERC777 change visibility of some attributes and methods from private to internal
See original GitHub issueš§ Motivation
Iām trying to extend the base ERC777 contract to be pauseable, but ran into an issue. The best way I can think of to accomplish this is to override _move()
, _mint()
and _burn()
to check if the contract is paused, but _move()
's visibility is private
, so it canāt be overridden. Iād also like to create setter methods for _name
and _symbol
but canāt because they are private also.
š Details
Iām wondering what the rationale is for making methods/attributes private and if itās okay to change some of them to internal
, namely move()
, _name
and _symbol
. Iāll submit a pull request if there are no objections.
Issue Analytics
- State:
- Created 4 years ago
- Comments:10 (7 by maintainers)
Top Results From Across the Web
Smart Contracts and Dapps: From Theory to Practice
Private ā Like internal visibility, but the function cannot be accessed from related deriving contracts. Functions Behavior. The pure, constant,Ā ...
Read more >rICO | ConsenSys Diligence
tokenAddress: The address of the ERC777 token used in the rICO ... This address can change the rICO address when the token is...
Read more >Chapter 10: Tokens Ā· GitBook
Another proposal for an improved token contract standard is ERC777. This proposal has several goals, including: To offer an ERC20-compatible interface. ToĀ ...
Read more >arXiv:2107.02997v1 [cs.CR] 7 Jul 2021
At first glance, re-entrancy might seem inapplicable to ERC-20 however any function that changes internal state, such as balances, need to be.
Read more >Solidity 201 - by Rajeev | Secureum
Function Overriding Changes: The overriding function may only change the visibility of the overridden function from external to public.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Wouldnāt this be desirable though? I would expect that if I pause the contract all moving is paused.
I still donāt think exposing
_move
is a good idea anyway.My proposal is to make the ERC777 interface functions
public
rather thanexternal
as they are now. This allows people to override them to add functionality and to create new external functions that make use of them.Hi @JonahGroendal! Your use case sounds quite reasonable!
Unfortunately though, we do have a strict policy of keeping all variables
private
.Rather than forking, I would highly encourage you to inherit the contract, create the 2 extra variables, and add overrides. I agree that it sounds messy, but itās more aligned with the recommended way to use the library. Itās highly discouraged to fork and modify the code for yourself because you can accidentally introduce bugs, and even though this particular case is harmless, when it comes to security conventions itās better to strictly follow them always.
Similarly to the private variables, I think
_move
is too low-level a function for us to safely expose internally. Unfortunately you wonāt be able to modifysend
andtransfer
through overrides either because theyāreexternal
andsuper.send
will not compile. This is a shortcoming of our current implementation that we should fix. We closed things down as much as possible initially to keep our options open, to see what features users would need and what would be the best interface we can provide for them. Apologies that you ran into these issues!@nventuro what do you think we should do here to enable the implementation of a
Pausable
ERC777
?