Skip to content

Commit

Permalink
Removed te extra logic that transfers and extra 2 wei for stETH
Browse files Browse the repository at this point in the history
  • Loading branch information
naddison36 committed Oct 10, 2024
1 parent 7aa4009 commit 11eb8e3
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 15 deletions.
2 changes: 1 addition & 1 deletion docs/LidoARMSquashed.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 0 additions & 13 deletions src/contracts/LidoARM.sol
Original file line number Diff line number Diff line change
Expand Up @@ -62,19 +62,6 @@ contract LidoARM is Initializable, AbstractARM {
steth.approve(address(lidoWithdrawalQueue), type(uint256).max);
}

/**
* @dev Due to internal stETH mechanics required for rebasing support, in most cases stETH transfers are performed
* for the value of 1 wei less than passed to transfer method. Larger transfer amounts can be 2 wei less.
*
* The MultiLP implementation ensures any WETH reserved for the withdrawal queue is not used in swaps from stETH to WETH.
*/
function _transferAsset(address asset, address to, uint256 amount) internal override {
// Add 2 wei if transferring stETH
if (asset == address(steth)) amount += 2;

super._transferAsset(asset, to, amount);
}

/**
* @notice Request a stETH for ETH withdrawal.
* Reference: https://docs.lido.fi/contracts/withdrawal-queue-erc721/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ contract Fork_Concrete_LidoARM_SwapTokensForExactTokens_Test is Fork_Shared_Test
vm.expectEmit({emitter: address(weth)});
emit IERC20.Transfer(address(this), address(lidoARM), amountIn);
vm.expectEmit({emitter: address(steth)});
emit IERC20.Transfer(address(lidoARM), address(this), amountOut + 2);
emit IERC20.Transfer(address(lidoARM), address(this), amountOut);
// Main call
lidoARM.swapTokensForExactTokens(
weth, // inToken
Expand Down

0 comments on commit 11eb8e3

Please sign in to comment.