Skip to content

Conversation

@Sunnesoft
Copy link

No description provided.

@Sunnesoft Sunnesoft requested a review from Copilot September 8, 2025 14:39
Copy link

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

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
Copy link

codecov bot commented Sep 8, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (948af77) to head (70ab8af).
⚠️ Report is 9 commits behind head on master.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

if (amount > 0) {
if (isETH(token)) {
if (address(this).balance < amount) revert InsufficientBalance();
to.safeSend(amount);
Copy link
Contributor

Choose a reason for hiding this comment

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

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);
Copy link
Contributor

Choose a reason for hiding this comment

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

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

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.

2 participants