Rename ETH to "gas token" and ambiguous functions#79
Conversation
There was a problem hiding this comment.
Pull request overview
This PR completes a sweeping rename of "ETH" to "gas token" across the Solidity contracts, interfaces, scripts, tests, and documentation (closes #70), to remove network-specific terminology. It also folds in a non-trivial refactor of the on-decrypt dispatch in ConfidentialToken and turns the wrapper's burn/withdrawTo paths into asynchronous, callback-finalized flows, plus a new pausable test ERC20 used for failure-path testing.
Changes:
- Renamed
ethBalanceOf/_ethBalance/InsufficientEth/EthBalanceToppedUp/EthWithdrawnand related docs/script identifiers to thegasToken*equivalents. - Extracted CTX submission, callback consumption, balance decoding, and the resubmit path in
ConfidentialToken; replaced theOnDecryptActionenum withuint8action constants and added an extensible_encryptedUpdateExtendedthat supports extra plaintext arguments. - Reworked
ConfidentialWrappersowithdrawTo/burnschedule an async_WITHDRAW_TOCTX whose callback (_handleWithdrawToRequest) releases underlying to the recipient encoded inplaintextArguments[2], and added invariant tests, stale-callback tests, and a newIPausableERC20test token.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| contracts/ConfidentialToken.sol | Rename ETH→gas token; refactor onDecrypt dispatch; extract _submitCTX, _reSubmitTransfer, _encryptedUpdateExtended |
| contracts/ConfidentialWrapper.sol | Async burn/withdrawTo via new _burnTo/_handleWithdrawToRequest; recipient encoded in plaintext args |
| contracts/interfaces/IConfidentialToken.sol | Event/error/function renames; updated NatSpec |
| contracts/interfaces/IConfidentialWrapper.sol | Added burn(uint256) to the wrapper interface |
| contracts/test/TestERC20.sol | New IPausableERC20 interface + pausable transfer support for tests |
| docs/* | Regenerated NatSpec for renamed identifiers and new wrapper functions |
| scripts/deployAndTestMintableCnfToken.ts | Renamed local constants and log strings |
| test/ConfidentialToken.ts, test/EIP3009.ts, test/tools/fixtures.ts | Updated to new identifiers |
| test/ConfidentialWrapper.ts | Added invariant, stale-callback, pausable-underlying, and zero-value tests |
| README.md | Updated function references and withdrawTo description |
| .github/agents/cnf-token-auditor.agent.md | Updated auditor checklist to new names |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #79 +/- ##
========================================
Coverage 97.84% 97.84%
========================================
Files 7 7
Lines 417 417
Branches 95 95
========================================
Hits 408 408
Misses 9 9 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Fixes #70