Add SubProcessor for 4626 shares swapping#225
Open
lastperson wants to merge 6 commits into
Open
Conversation
mpetrunic
reviewed
May 28, 2026
There was a problem hiding this comment.
Pull request overview
Adds a SubProcessor helper that allows the Processor to convert 4626 vault shares to USDC via arbitrary external calls (e.g. a Curve swap) instead of going through a slow ERC-7540/Royco redemption, and adds the ability to cancel a pending Royco withdrawal. A new CONFIG_ROLE and configurable max slippage are introduced, and the deploy/upgrade scripts are updated to wire up the new SubProcessor and roles.
Changes:
- New
SubProcessorcontract for isolated arbitrary-call execution that sweeps leftoverASSETback to its owner (Processor). Processor: new ERC-7201 storage withsubProcessorandmaxSlippage, newprocess4626,cancelRoyco,adminProcess,setMaxSlippage, andinitializeSubProcessorfunctions, plusCONFIG_ROLE.- Deploy/upgrade scripts and
package.jsonscripts updated for the newProcessorshape;IRoycogainscancelRequest; comprehensive tests added.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| contracts/SubProcessor.sol | New helper contract executing owner-only batched calls and sweeping ASSET back to owner. |
| contracts/Processor.sol | Adds SubProcessor wiring, slippage config, process4626/cancelRoyco/adminProcess, and ERC-7201 storage. |
| contracts/interfaces/IRoyco.sol | Adds cancelRequest(uint256) to the minimal Royco interface. |
| contracts/testing/TestRoyco.sol | Stub cancelRequest to support test scenarios. |
| scripts/deployUSDCProcessor.ts | Updates initializer args to include CONFIG_ROLE and accounts for SubProcessor deployment in CREATE nonce. |
| scripts/upgradeUSDCProcessor.ts | Rewritten to upgrade to new Processor, initialize SubProcessor, and grant CONFIG_ROLE. |
| scripts/helpers.ts | deployProxyX gains contractsDeployedInInit to correctly compute the ProxyAdmin address. |
| scripts/test.ts | Runs deploy + upgrade USDC processor in the test deploy pipeline. |
| hardhat.config.ts | FORK_BLOCK_NUMBER only applied when not using DRY_RUN/FORK_TEST. |
| package.json | Renamed/added upgrade-usdc-processor-* scripts and dry-run variants. |
| test/Processor.ts | Extensive new tests for process4626, cancelRoyco, adminProcess, slippage, and SubProcessor behavior. |
| coverage-baseline.json | Coverage baseline numbers updated. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
mpetrunic
previously approved these changes
May 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes: #224
Repayment service can cancel royco withdrawal, then use
process4626()to convert it to USDC by other means (eg. through curve swap).