-
Notifications
You must be signed in to change notification settings - Fork 56
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
feat: Use @openzeppelin/[email protected] contracts in contracts we can upgrade #598
Conversation
…pgrade Imports an [aliased npm package](https://forum.openzeppelin.com/t/coexist-of-v5-and-v4-contracts/38030/5) so we can use multiple oz libraries in the same solidity contracts. This way we get access to new and improved contracts. I make changes to all contracts that we can upgrade, such as SpokePools and NOT the HubPool. For example, I can use the new SafeERC20 method `forceApprove` instead of `safeIncreaseAllowance` which ensures [compatibility with tokens like USDT](OpenZeppelin/openzeppelin-contracts#4231) that make sure all approvals are set to 0 before granting a new approval. This hasn't been an issue so far because we always safeIncreaseAllowance to some number and use the complete allowance, but its worth safety checking. Other changes: - Moved `MerkleDistributor` out of uma/core into this repo to reduce dependency on this external repo - Replaced isCode() call with now [recommended](OpenZeppelin/openzeppelin-contracts#3945) explicit .code.length check - Explicitly set SpokePoolVerifier pragma to 0.8.19 and removed the overrides in hardhat.config.ts - Removed unused import in PolygonERC20Test
pragma solidity ^0.8.0; | ||
// NOTE: Linea and Arbitrum only support 0.8.19, so keep this contract at 19 so create2 addressses for all chains are | ||
// the same. | ||
pragma solidity ^0.8.19; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be =0.8.19?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think that's right
I need to revise this PR and remove all the contracts5 imports into SpokePool because Arbitrum/Linea_SpokePool can't use those new contracts because they must be compiled with 8.19 while contracts5 uses 8.20 |
Imports an aliased npm package so we can use multiple oz libraries in the same solidity contracts.
This way we get access to new and improved contracts. I make changes to all contracts that we can upgrade, such as SpokePools and NOT the HubPool.
For example, I can use the new SafeERC20 method
forceApprove
instead ofsafeIncreaseAllowance
which ensures compatibility with tokens like USDT that make sure all approvals are set to 0 before granting a new approval. This hasn't been an issue so far because we always safeIncreaseAllowance to some number and use the complete allowance, but its worth safety checking.Other changes:
MerkleDistributor
out of uma/core into this repo to reduce dependency on this external repo