Usage of SafeERC20 makes contract not upgrade-safe
See original GitHub issueSafeERC20 from the Openzepelin contracts is a very popular Lib. However, using it in an upgradable contracts makes them non upgrade-safe according to the plugin.
More specifically, the following error is thrown
Error: Contract `Contract` is not upgrade safe
@openzeppelin/contracts/utils/Address.sol:185: Use of delegatecall is not allowed
https://zpl.in/upgrades/error-002
At the moment I’m ignoring that error by setting
unsafeAllow: ['delegatecall']
However, this is unclear whether it will cause issues or not.
Would it be possible to clarify this point. SafeERC20 is a very popular lib so I believe many users will experience this issue.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Contract is not upgrade safe. Use of delegatecall is not allowed
I am trying to test deployment through a proxy. My contract does not have any delegate calls, neither selfdestruct. However, after upgrades.
Read more >What's the benefit of using SafeERC20?
SafeERC20 is a wrapper library around ERC20 calls that make safe the interaction with someone else's ERC20 token, in your contracts.
Read more >Ethereum Contract Diff Checker - Etherscan
Contract Diff Checker ... Please enter a contract address above to load the contract details and source code. ... Etherscan is a Block...
Read more >Upgrading Smart Contracts - Should You Do it and How?
First off, our contract needs to be upgrade safe. This means that the contract: cannot have a constructor; should not use the selfdestruct...
Read more >Audit Findings 101 - by Rajeev | Secureum
addLiquidity() creates the desired pair contract if it does not already exist, ... Recommendation: Consider using OpenZeppelin's SafeERC20.
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
Hello @ppoliani
SafeERC20
, found in the@openzeppelin/contracts
repository, does depend onAddress
, which contains non-upgrade-safe functions. Due to current limitations, we are not able to clearly identity which function in library are called, and if they are upgrade-safe… Thus making theSafeERC20
flagged as potentially upgrade-unsafe.A good option for you would be to use
SafeERC20Upgradeable
from the@openzeppelin/contracts-upgradeable
repository. This version depends onAddressUpgradeable
which is upgrade-safe.@jmendiola222 Issue https://github.com/OpenZeppelin/openzeppelin-upgrades/issues/240 is what would fix this problem.