Skip to content

Conversation

@Brenzee
Copy link

@Brenzee Brenzee commented Sep 12, 2025

No description provided.

Copy link
Contributor

@vnavascues vnavascues left a comment

Choose a reason for hiding this comment

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

Tiny changes and suggestions


import { Initializable } from "openzeppelin-contracts/proxy/utils/Initializable.sol";

contract EnsoWalletV2 is AbstractMultiSend, AbstractEnsoShortcuts, Initializable, Withdrawable {
Copy link
Contributor

@vnavascues vnavascues Nov 6, 2025

Choose a reason for hiding this comment

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

It misses inheriting from IEnsoWalletV2, document the interface, and then NatSpec can just inherit from it.

@@ -0,0 +1,91 @@
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.8.20;
Copy link
Contributor

Choose a reason for hiding this comment

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

pragma solidity ^0.8.28; (determined by AbstractMultiSend.sol.

import { IERC721 } from "openzeppelin-contracts/token/ERC721/IERC721.sol";
import { LibClone } from "solady/utils/LibClone.sol";

contract EnsoWalletV2Factory {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd create the IEnsoWalletV2Factory interface where to locate the errors, events and methods


address public immutable implementation;

event EnsoWalletV2Deployed(address wallet, address indexed account);
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd index wallet too here just in case

}
}

function _getSalt(address account) internal pure returns (bytes32) {
Copy link
Contributor

@vnavascues vnavascues Nov 6, 2025

Choose a reason for hiding this comment

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

I'd replace internal with private


bool success;
(success, response) = wallet.call{ value: msg.value }(data);
if (!success) {
Copy link
Contributor

Choose a reason for hiding this comment

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

if (response.length > 0) {
  assembly ("memory-safe") {
    revert(add(0x20, response), mload(response))
  }
}
revert ExecutionFailed(); // NOTE: this custom error should be created

This no only bubbles up any existing revert reason (like you did but adding memory-safe), but also forces a revert if there isn't one (custom error should be created). More about this:
https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/Address.sol#L88
https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/LowLevelCall.sol#L122

I reckon we should ideally update EnsoRouter with this change too

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, we should probably add this low-level call response handling to EnsoWalletV2.sol::execute (but not using assembly for the call, only to handle the error):

    (bool success, bytes memory response) = target.call{value: msg.value}(data);
    if (!success) {
      if (response.length > 0) {
        assembly ("memory-safe") {
          revert(add(0x20, response), mload(response))
        }
      }
      revert ExecutionFailed(); // NOTE: this custom error should be created on the interface
    }

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.

3 participants