Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds safe send functionality for UniERC20 operations to ensure Ether transfers succeed even when recipients have failing receive/fallback functions. The implementation uses a new SafeSendLib that leverages assembly code with selfdestruct to force Ether delivery.
- Added SafeSendLib library with assembly-based safe send mechanism
- Implemented uniSafeTransfer and uniSafeTransferFrom functions in UniERC20
- Added corresponding test coverage and mock contract interfaces
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| contracts/libraries/SafeSendLib.sol | New library implementing safe Ether transfer using selfdestruct |
| contracts/libraries/UniERC20.sol | Added safe transfer functions that use SafeSendLib for ETH transfers |
| contracts/tests/mocks/UniERC20Helper.sol | Added mock interfaces and implementations for testing safe transfers |
| test/contracts/UniERC20.test.ts | Added test cases for safe transfer functionality |
| docgen/index.ts | Duplicate export statement added |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #199 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 17 18 +1
Lines 346 364 +18
Branches 65 74 +9
=========================================
+ Hits 346 364 +18 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| if (amount > 0) { | ||
| if (isETH(token)) { | ||
| if (address(this).balance < amount) revert InsufficientBalance(); | ||
| to.safeSend(amount); |
There was a problem hiding this comment.
What about check address(this).code.length == 0 that code is executing inside the constructor?
| if (msg.value > amount) { | ||
| // Return remainder if exist | ||
| unchecked { | ||
| from.safeSend(msg.value - amount); |
There was a problem hiding this comment.
The method sends ETH from msg.sender to somewhere vie eip7702? It's not obvious where the funds will go despite that the description is they have to go to the to
No description provided.