chore: Misc improvements:

- Don't use payable(receiver).transfer(amount) and use OpenZeppelin's Address.sendValue instead
- In Univ4Executor send funds to the poolManager and not msg.sender
- In OneTransferFromOnly:
  - rename method name
  - don't pass the sender but hardcode it to caller() (msg.sender)
  - Move marking the transfer as done up (before we actually transfer) to prevent reentrancy attacks

Took 18 minutes
This commit is contained in:
Diana Carvalho
2025-05-16 10:49:49 +01:00
parent 99d5df4f77
commit fcd85c047f
6 changed files with 23 additions and 29 deletions

View File

@@ -12,6 +12,7 @@ import {LibBytes} from "@solady/utils/LibBytes.sol";
import {Config, EkuboPoolKey} from "@ekubo/types/poolKey.sol";
import {MAX_SQRT_RATIO, MIN_SQRT_RATIO} from "@ekubo/types/sqrtRatio.sol";
import "../OneTransferFromOnly.sol";
import "@openzeppelin/contracts/utils/Address.sol";
contract EkuboExecutor is
IExecutor,
@@ -204,11 +205,7 @@ contract EkuboExecutor is
if (transferFromNeeded) {
_transfer(msg.sender);
} else if (transferNeeded) {
if (token == address(0)) {
payable(msg.sender).transfer(amount);
} else {
IERC20(token).safeTransfer(msg.sender, amount);
}
IERC20(token).safeTransfer(msg.sender, amount);
}
}