refactor: prepare SingleRequestFactory for deployment with Request Deployer#1473
Conversation
WalkthroughThe pull request introduces modifications to the Changes
Possibly related PRs
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 4
🧹 Outside diff range comments (1)
packages/smart-contracts/test/contracts/SingleRequestProxyFactory.test.ts (1)
Line range hint
1-214: LGTM! Consider adding a test for the new constructor parameter.The test file provides comprehensive coverage of the
SingleRequestProxyFactoryfunctionalities, including proxy creation, fee proxy updates, and ownership management. The existing tests align well with the contract's features and the recent changes.For consistency and to fully cover the recent changes, consider adding a specific test case for the new constructor parameter. This test should verify that attempting to deploy the
SingleRequestProxyFactorywith an invalid owner address (e.g., zero address) results in a revert. For example:it('should revert when deploying with zero address as owner', async () => { const SingleRequestProxyFactoryFactory = await ethers.getContractFactory( 'SingleRequestProxyFactory', ); await expect( SingleRequestProxyFactoryFactory.deploy( ethereumFeeProxy.address, erc20FeeProxy.address, ethers.constants.AddressZero ) ).to.be.revertedWith('Owner address cannot be zero'); });This addition would ensure that the new constructor parameter is thoroughly tested, including its error handling.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
📒 Files selected for processing (4)
- packages/smart-contracts/scripts-create2/constructor-args.ts (1 hunks)
- packages/smart-contracts/scripts-create2/verify.ts (1 hunks)
- packages/smart-contracts/src/contracts/SingleRequestProxyFactory.sol (1 hunks)
- packages/smart-contracts/test/contracts/SingleRequestProxyFactory.test.ts (1 hunks)
🧰 Additional context used
📓 Learnings (1)
packages/smart-contracts/src/contracts/SingleRequestProxyFactory.sol (1)
Learnt from: MantisClone PR: RequestNetwork/requestNetwork#1453 File: packages/smart-contracts/src/contracts/SingleRequestProxyFactory.sol:0-0 Timestamp: 2024-09-27T11:42:01.062Z Learning: In the `createEthereumSingleRequestProxy` function, it's acceptable for `_feeAddress` to be the zero address, as setting the fee address to zero is a common practice. Adding zero address checks is unnecessary and adds extra gas cost.
🔇 Additional comments (1)
packages/smart-contracts/src/contracts/SingleRequestProxyFactory.sol (1)
Line range hint
44-120: LGTM! Unchanged parts are consistent with previous learnings.The rest of the file remains unchanged, which is consistent with the PR objectives. I noticed that the
createEthereumSingleRequestProxyfunction allows_feeAddressto be zero, which aligns with the previous learning:In the
createEthereumSingleRequestProxyfunction, it's acceptable for_feeAddressto be the zero address, as setting the fee address to zero is a common practice. Adding zero address checks is unnecessary and adds extra gas cost.This approach maintains consistency and optimizes gas usage.
packages/smart-contracts/test/contracts/SingleRequestProxyFactory.test.ts
Show resolved
Hide resolved
MantisClone
left a comment
There was a problem hiding this comment.
Nice work resolving the CodeRabbit comments with explanations!
Refactor the
SingleRequestProxyFactoryto be deployed by using the Request Deployer.transferOwnershipto construct to have the correct owner of smart contract instead of Request Deployer.SingleRequestProxyFactoryto verify methodSummary by CodeRabbit
New Features
SingleRequestProxyFactorycontract now includes an owner parameter for improved ownership management.SingleRequestProxyFactory.Bug Fixes
Tests