refactor native token support#4
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Refactors the codebase’s native-token handling by removing the custom EthPool wrapper and instead wiring CelerLedger to a chain’s canonical wrapped-native (WETH9-style) contract for the multi-party-funding path, while keeping the user-facing “native” semantics (address(0), msg.value) intact.
Changes:
- Replace
EthPoolwithINativeWrap/nativeWrapthroughout ledger storage, constructor wiring, funding flows, and getters. - Rename native token type from
ETHtoNATIVEin protobuf/Solidity enums and update interfaces/docs accordingly (incl.depositETH→depositNative). - Update tests, gas reports, deployment scripts, and documentation to reflect the new wrapped-native plumbing and removal of
EthPool.
Reviewed changes
Copilot reviewed 33 out of 33 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| test/utils/LedgerTestBase.t.sol | Updates test funding setup to wrap native into nativeWrap and approve ledger for pull-based funding. |
| test/utils/Base.t.sol | Replaces EthPool deployment with NativeWrapMock and wires CelerLedger with nativeWrap. |
| test/GasReport.t.sol | Updates gas report to measure NativeWrapMock deployment and nativeWrap-based deposit paths; removes EthPool report. |
| test/gas_logs/fine_granularity/DepositEthInBatch.txt | Updates recorded gas numbers after native token flow changes. |
| test/gas_logs/EthPool.txt | Removes EthPool gas log (contract removed). |
| test/gas_logs/CelerLedger-Migrate.txt | Updates recorded gas numbers post-refactor. |
| test/gas_logs/CelerLedger-ETH.txt | Updates deployment + function-call gas numbers and labels for nativeWrap-based flows. |
| test/gas_logs/CelerLedger-ERC20.txt | Updates recorded gas numbers post-refactor. |
| test/EthPool.t.sol | Removes EthPool unit tests (contract removed). |
| test/CelerWallet.t.sol | Renames wallet native deposit test calls to depositNative. |
| test/CelerLedger.Migrate.t.sol | Wires migration tests to new-ledger construction via nativeWrap and updates approvals. |
| test/CelerLedger.ETH.t.sol | Renames/extends ETH(native) tests for wrapped-native deposit path and restricted receive(). |
| src/lib/ledgerlib/LedgerStruct.sol | Replaces IEthPool storage with INativeWrap in ledger state. |
| src/lib/ledgerlib/LedgerOperation.sol | Refactors native funding/deposit logic to pull wrapped-native, unwrap, and forward native into CelerWallet. |
| src/lib/ledgerlib/LedgerBalanceLimit.sol | Updates NatSpec to describe address(0) as “native” rather than “ETH”. |
| src/lib/interface/INativeWrap.sol | Adds minimal wrapped-native interface (ERC20 + deposit/withdraw). |
| src/lib/interface/IEthPool.sol | Removes EthPool interface. |
| src/lib/interface/ICelerWallet.sol | Renames native deposit API to depositNative and updates NatSpec language. |
| src/lib/interface/ICelerLedger.sol | Updates NatSpec/getter from getEthPool to getNativeWrap and native-token terminology. |
| src/lib/data/proto/entity.proto | Renames TokenType.ETH to TokenType.NATIVE (value preserved). |
| src/lib/data/PbEntity.sol | Renames Solidity enum entry ETH → NATIVE. |
| src/helper/NativeWrapMock.sol | Adds a test-only wrapped-native mock used by Foundry tests. |
| src/EthPool.sol | Removes EthPool implementation. |
| src/CelerWallet.sol | Renames depositETH → depositNative and updates native-related wording/error message. |
| src/CelerLedgerMock.sol | Updates mock ledger constructor/getter naming to nativeWrap. |
| src/CelerLedger.sol | Wires ledger to nativeWrap, adds restricted receive(), and updates getter to getNativeWrap. |
| script/README.md | Updates deployment instructions for new nativeWrap config and removal of EthPool deploy. |
| script/example_config.json | Replaces ethPool config field with nativeWrap. |
| script/DeployLedger.s.sol | Reads nativeWrap from config and passes it to CelerLedger constructor. |
| script/DeployCore.s.sol | Removes EthPool from core deployment script and output. |
| README.md | Updates component list/docs to reflect EthPool removal and wrapped-native dependency. |
| docs/contracts.md | Removes EthPool section; updates ledger/wallet docs for nativeWrap and depositNative. |
| docs/architecture-summary.md | Updates architecture summary to reflect EthPool removal and wrapped-native dependency. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
No description provided.