Skip to content

Commit

Permalink
fix: remove implementation of sweep methods
Browse files Browse the repository at this point in the history
- removed implementation of sweep tokens methods in uniswap adapter. Since we do not support fee on transfer, sweep token would be encoded, but txn would would fail as we don't use router/npm as custody and router/npm nevel hold balance as a consequence. If, on the other hand, a client would set a fee when swapping for ETH, the unwrap method would not unwrap, i.e. user would receive the full amount in WETH. In NPM sweep method is encoded when removing liquidity to receive ETH, but we never use it since we don't use uniswap as custody for txn.
- added missing override to wrapETH method
  • Loading branch information
gabririgo committed Sep 7, 2023
1 parent 7dc1914 commit 9f00adb
Showing 1 changed file with 5 additions and 23 deletions.
28 changes: 5 additions & 23 deletions contracts/protocol/extensions/adapters/AUniswap.sol
Original file line number Diff line number Diff line change
Expand Up @@ -235,32 +235,22 @@ contract AUniswap is IAUniswap, AUniswapV3NPM {
* UNISWAP V3 PAYMENT METHODS
*/
/// @inheritdoc IAUniswap
function sweepToken(address token, uint256 amountMinimum) external override {
ISwapRouter02(_getUniswapRouter2()).sweepToken(token, amountMinimum);
}
function sweepToken(address token, uint256 amountMinimum) external virtual override {}

/// @inheritdoc IAUniswap
function sweepToken(
address token,
uint256 amountMinimum,
address recipient
) external override {
ISwapRouter02(_getUniswapRouter2()).sweepToken(
token,
amountMinimum,
recipient != address(this) ? address(this) : address(this) // this pool is always the recipient
);
}
) external virtual override {}

/// @inheritdoc IAUniswap
function sweepTokenWithFee(
address token,
uint256 amountMinimum,
uint256 feeBips,
address feeRecipient
) external override {
ISwapRouter02(_getUniswapRouter2()).sweepTokenWithFee(token, amountMinimum, feeBips, feeRecipient);
}
) external virtual override {}

/// @inheritdoc IAUniswap
function sweepTokenWithFee(
Expand All @@ -269,15 +259,7 @@ contract AUniswap is IAUniswap, AUniswapV3NPM {
address recipient,
uint256 feeBips,
address feeRecipient
) external override {
ISwapRouter02(_getUniswapRouter2()).sweepTokenWithFee(
token,
amountMinimum,
recipient != address(this) ? address(this) : address(this), // this pool is always the recipient
feeBips,
feeRecipient
);
}
) external virtual override {}

/// @inheritdoc IAUniswap
function unwrapWETH9(uint256 amountMinimum) external override {
Expand Down Expand Up @@ -308,7 +290,7 @@ contract AUniswap is IAUniswap, AUniswapV3NPM {
) external virtual override {}

/// @inheritdoc IAUniswap
function wrapETH(uint256 value) external {
function wrapETH(uint256 value) external override {
if (value > uint256(0)) {
IWETH9(_getWeth()).deposit{value: value}();
}
Expand Down

0 comments on commit 9f00adb

Please sign in to comment.