Skip to content

feat: add ERC20 withdrawal recovery adaptor - #199

Open
zmanian wants to merge 2 commits into
mainfrom
feat/optimism-ryeth-recovery-adaptor
Open

zmanian wants to merge 2 commits into
mainfrom
feat/optimism-ryeth-recovery-adaptor

Conversation

@zmanian

@zmanian zmanian commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

The live Optimism RYETH recovery flow uses a separately identified ERC20 adaptor, but that adaptor was not represented in cellar-contracts. This adds the reviewable repository source and records the exact deployment evidence.

The new ERC20WithdrawalRecoveryAdaptor inherits the audited ERC20 behavior and overrides only identifier(). The existing ERC20Adaptor identifier remains unchanged; it is marked virtual solely to permit the isolated recovery identifier.

Deployment evidence:

  • Optimism contract: 0x214ff95df1Ec8238977dACAeD9768441ce7d05dc
  • Deployment transaction: 0x65bb90168ba5a3459d09c631105fb7cf8e53ac3820069b77f6927278dc02477d
  • Full live runtime hash: 0x0d037adbce330a32869a4ba8a29f93c56aa3767094a9185405061b2c6a38fb12
  • Metadata-free runtime hash: 0x5509c54323791d5da52562bf42d23f36858c1bd57454abe30ad056f5fc3ff0cb

The repository build has the same 2,256-byte metadata-free runtime as the deployed contract. Solidity metadata differs because this reviewable version uses a distinct source path and contract name; the deployment manifest states that boundary explicitly.

Validation:

  • forge build
  • forge test --match-contract ERC20WithdrawalRecoveryAdaptorTest — 3 passed
  • forge fmt --check src/modules/adaptors/ERC20WithdrawalRecoveryAdaptor.sol test/testAdaptors/ERC20WithdrawalRecoveryAdaptor.t.sol
  • git diff --check
  • live Optimism identifier(), isDebt(), full runtime hash, and metadata-free bytecode comparison

The full forge test run compiled successfully, but local fork tests could not complete because the public Ethereum and Arbitrum endpoints reject the suite's historical archive reads. GitHub CI supplies the repository's configured archive RPC secrets.

Summary by CodeRabbit

  • New Features
    • Added an ERC20 withdrawal recovery adaptor with a distinct identifier. Recovery positions are classified as collateral rather than debt.
    • The adaptor is deployed on Optimism.

@coderabbitai

coderabbitai Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 44 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 73dd5ddd-144d-4cd7-aa2f-dbee9ee6c1da
📥 Commits

Reviewing files that changed from the base of the PR and between dfe423c and 8083988.

📒 Files selected for processing (4)
  • deployments/optimism/ryeth-withdrawal-recovery-adaptor.deployed-source.sol
  • deployments/optimism/ryeth-withdrawal-recovery-adaptor.json
  • src/modules/adaptors/ERC20WithdrawalRecoveryAdaptor.sol
  • test/testAdaptors/ERC20WithdrawalRecoveryAdaptor.t.sol

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 571f5578-676b-42db-8d43-be5dfac8bf90
📥 Commits

Reviewing files that changed from the base of the PR and between 07efdfa and dfe423c.

📒 Files selected for processing (4)
  • deployments/optimism/ryeth-withdrawal-recovery-adaptor.json
  • src/modules/adaptors/ERC20Adaptor.sol
  • src/modules/adaptors/ERC20WithdrawalRecoveryAdaptor.sol
  • test/testAdaptors/ERC20WithdrawalRecoveryAdaptor.t.sol

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The change adds ERC20WithdrawalRecoveryAdaptor, tests its identifier, debt status, and runtime bytecode, and records its Optimism deployment metadata.

Changes

ERC20 withdrawal recovery adaptor

Layer / File(s) Summary
Adaptor implementation and validation
src/modules/adaptors/ERC20Adaptor.sol, src/modules/adaptors/ERC20WithdrawalRecoveryAdaptor.sol, test/testAdaptors/ERC20WithdrawalRecoveryAdaptor.t.sol
Makes ERC20Adaptor.identifier() overridable and adds a subclass with a distinct identifier. Tests check identifier isolation, collateral status, and semantic runtime bytecode.
Optimism deployment record
deployments/optimism/ryeth-withdrawal-recovery-adaptor.json
Adds deployment details, compiler settings, identifiers, bytecode hashes, and source comparison notes.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature

Merge Risk: ⚪ Minimal · up to dfe42

The recovery adaptor’s recorded identity and runtime match the observed Optimism deployment; no concrete merge-blocking issue was found.

Architecture Summary

Architecture risk: 🔵 Low · up to dfe42

The change affects 3 systems.

Changed systems: src, deployments, test

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — src (service) was modified; 2 changed files map to changed impact.
  • observed — deployments (service) was modified; 1 changed file maps to changed impact.
  • observed — test (service) was modified; 1 changed file maps to changed impact.

Before / after behavior

  • observed — Modified behavior in deployments/optimism/ryeth-withdrawal-recovery-adaptor.json: Added the Optimism adaptor deployment record with contract and deployment details, compiler configuration, identifiers and bytecode hashes, and descriptions of the deployed source and repository implementation.
  • observed — Modified behavior in src/modules/adaptors/ERC20Adaptor.sol: identifier() is now virtual; its implementation and return value are unchanged.
  • observed — Modified behavior in src/modules/adaptors/ERC20WithdrawalRecoveryAdaptor.sol: Adds ERC20WithdrawalRecoveryAdaptor, inheriting from ERC20Adaptor, with an overridden identifier() that returns a hash distinctively named for withdrawal recovery positions.
  • observed — Modified behavior in test/testAdaptors/ERC20WithdrawalRecoveryAdaptor.t.sol: Adds the test contract and setup that deploys the recovery adaptor, plus a test comparing its expected identifier with the standard ERC20 adaptor’s expected identifier.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding the ERC20 withdrawal recovery adaptor.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

- Warn in ERC20WithdrawalRecoveryAdaptor that it must replace, never sit
  beside, an ERC20Adaptor position for the same token; otherwise the token
  is counted twice in totalAssets.
- Commit the exact deployed source. Compiled as
  src/modules/adaptors/ERC20Adaptor.sol at 07efdfa, it reproduces the full
  live runtime including metadata (0x0d037adb...fb12), so it can be used for
  block explorer verification.
- Record intended use in the manifest: replaces position 9 (rETH via
  ERC20Adaptor) with 9999 on the Optimism RYETH vault, plus the live state
  checked at block 157789515.
- Note that the "Candidate" identifier string is fixed by the deployment,
  and that the bytecode pin test is intentional.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant