@@ -82,7 +82,7 @@ contract AaveETHYieldBackend is AaveYieldBackend {
8282 // fallback function of the SuperToken contract.
8383 uint256 withdrawnAmount = AAVE_POOL.withdraw (address (ASSET_TOKEN), amount, address (_SELF));
8484 // unwrap to ETH and transfer it to the calling SuperToken contract
85- _SELF.unwrapWETHAndForwardETH (withdrawnAmount);
85+ _SELF.unwrapWETHAndForwardETH (withdrawnAmount, address ( this ) );
8686 }
8787
8888 // ============ functions operating on this contract itself (NOT in delegatecall context) ============
@@ -92,11 +92,11 @@ contract AaveETHYieldBackend is AaveYieldBackend {
9292
9393 // To be invoked by `withdraw` which is executed via delegatecall in a SuperToken context.
9494 // WETH deposited or withdrawn by the SuperToken never stays in this contract beyond the lifetime of the tx.
95- // Thus it is not necessary to check msg.sender.
95+ // Thus it is not necessary to restrict msg.sender.
9696 // We accept that an alien caller may withdraw WETH deposited to this contract (for whatever reason).
97- function unwrapWETHAndForwardETH (uint256 amount ) external {
97+ function unwrapWETHAndForwardETH (uint256 amount , address recipient ) external {
9898 IWETH (address (ASSET_TOKEN)).withdraw (amount);
99- (bool success ,) = address ( msg . sender ) .call { value: amount }("" );
99+ (bool success ,) = recipient .call { value: amount }("" );
100100 require (success, "call failed " );
101101 }
102102}
0 commit comments