Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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;
}
2 changes: 1 addition & 1 deletion contracts/docs/NativeStakingSSVStrategySquashed.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.