Skip to content

Add SubProcessor for 4626 shares swapping#225

Open
lastperson wants to merge 6 commits into
mainfrom
feat/processor-process4626-royco
Open

Add SubProcessor for 4626 shares swapping#225
lastperson wants to merge 6 commits into
mainfrom
feat/processor-process4626-royco

Conversation

@lastperson
Copy link
Copy Markdown
Collaborator

Closes: #224

Repayment service can cancel royco withdrawal, then use process4626() to convert it to USDC by other means (eg. through curve swap).

@lastperson lastperson self-assigned this May 28, 2026
@lastperson lastperson requested review from mpetrun5 and mpetrunic May 28, 2026 12:25
Comment thread contracts/Processor.sol
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 SubProcessor contract for isolated arbitrary-call execution that sweeps leftover ASSET back to its owner (Processor).
  • Processor: new ERC-7201 storage with subProcessor and maxSlippage, new process4626, cancelRoyco, adminProcess, setMaxSlippage, and initializeSubProcessor functions, plus CONFIG_ROLE.
  • Deploy/upgrade scripts and package.json scripts updated for the new Processor shape; IRoyco gains cancelRequest; 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.

Comment thread scripts/upgradeUSDCProcessor.ts Outdated
Comment thread scripts/upgradeUSDCProcessor.ts
Comment thread contracts/Processor.sol
mpetrunic
mpetrunic previously approved these changes May 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Swap royco instead of redeeming if cost effective

3 participants