diff --git a/contracts/contracts/strategies/NativeStaking/NativeStakingSSVStrategy.sol b/contracts/contracts/strategies/NativeStaking/NativeStakingSSVStrategy.sol index 0dcc073688..ed7377eec6 100644 --- a/contracts/contracts/strategies/NativeStaking/NativeStakingSSVStrategy.sol +++ b/contracts/contracts/strategies/NativeStaking/NativeStakingSSVStrategy.sol @@ -191,6 +191,8 @@ contract NativeStakingSSVStrategy is require(_amount > 0, "Must withdraw something"); require(_recipient != address(0), "Must specify recipient"); + _wethWithdrawn(_amount); + IERC20(_asset).safeTransfer(_recipient, _amount); emit Withdrawal(_asset, address(0), _amount); } @@ -300,11 +302,14 @@ contract NativeStakingSSVStrategy is emit Withdrawal(WETH, address(0), _amount); } - function _wethWithdrawnAndStaked(uint256 _amount) internal override { + /// @dev Called when WETH is withdrawn from the strategy or staked to a validator so + /// the strategy knows how much WETH it has on deposit. + /// This is so it can emit the correct amount in the Deposit event in depositAll(). + function _wethWithdrawn(uint256 _amount) internal override { /* In an ideal world we wouldn't need to reduce the deduction amount when the * depositedWethAccountedFor is smaller than the _amount. * - * The reason this is required is that a malicious actor could sent WETH direclty + * The reason this is required is that a malicious actor could sent WETH directly * to this contract and that would circumvent the increase of depositedWethAccountedFor * property. When the ETH would be staked the depositedWethAccountedFor amount could * be deducted so much that it would be negative. diff --git a/contracts/contracts/strategies/NativeStaking/ValidatorAccountant.sol b/contracts/contracts/strategies/NativeStaking/ValidatorAccountant.sol index d03f2d19a6..1b252e03b1 100644 --- a/contracts/contracts/strategies/NativeStaking/ValidatorAccountant.sol +++ b/contracts/contracts/strategies/NativeStaking/ValidatorAccountant.sol @@ -253,6 +253,6 @@ abstract contract ValidatorAccountant is ValidatorRegistrator { Abstract ****************************************/ - /// @dev allows for NativeStakingSSVStrategy contract to emit Withdrawal event + /// @dev allows for NativeStakingSSVStrategy contract to emit the Withdrawal event function _wethWithdrawnToVault(uint256 _amount) internal virtual; } diff --git a/contracts/contracts/strategies/NativeStaking/ValidatorRegistrator.sol b/contracts/contracts/strategies/NativeStaking/ValidatorRegistrator.sol index 2c8f0c8670..71c4daecf8 100644 --- a/contracts/contracts/strategies/NativeStaking/ValidatorRegistrator.sol +++ b/contracts/contracts/strategies/NativeStaking/ValidatorRegistrator.sol @@ -180,7 +180,7 @@ abstract contract ValidatorRegistrator is Governable, Pausable { // Convert required ETH from WETH IWETH9(WETH).withdraw(requiredETH); - _wethWithdrawnAndStaked(requiredETH); + _wethWithdrawn(requiredETH); /* 0x01 to indicate that withdrawal credentials will contain an EOA address that the sweeping function * can sweep funds to. @@ -338,6 +338,8 @@ abstract contract ValidatorRegistrator is Governable, Pausable { Abstract ****************************************/ - /// @dev allows for NativeStakingSSVStrategy contract know how much WETH had been staked - function _wethWithdrawnAndStaked(uint256 _amount) internal virtual; + /// @dev Called when WETH is withdrawn from the strategy or staked to a validator so + /// the strategy knows how much WETH it has on deposit. + /// This is so it can emit the correct amount in the Deposit event in depositAll(). + function _wethWithdrawn(uint256 _amount) internal virtual; } diff --git a/contracts/docs/NativeStakingSSVStrategySquashed.svg b/contracts/docs/NativeStakingSSVStrategySquashed.svg index 0913f2ed0e..b95f083f90 100644 --- a/contracts/docs/NativeStakingSSVStrategySquashed.svg +++ b/contracts/docs/NativeStakingSSVStrategySquashed.svg @@ -73,7 +73,7 @@    _msgData(): bytes <<Context>>    _pause() <<whenNotPaused>> <<Pausable>>    _unpause() <<whenPaused>> <<Pausable>> -    _wethWithdrawnAndStaked(_amount: uint256) <<NativeStakingSSVStrategy>> +    _wethWithdrawn(_amount: uint256) <<NativeStakingSSVStrategy>>    _doAccounting(pauseOnFail: bool): (accountingValid: bool) <<ValidatorAccountant>>    _failAccounting(pauseOnFail: bool): (accountingValid: bool) <<ValidatorAccountant>>    _wethWithdrawnToVault(_amount: uint256) <<NativeStakingSSVStrategy>>