diff --git a/contracts/contracts/strategies/sonic/SonicStakingStrategy.sol b/contracts/contracts/strategies/sonic/SonicStakingStrategy.sol index 0de80eff30..0c760931b1 100644 --- a/contracts/contracts/strategies/sonic/SonicStakingStrategy.sol +++ b/contracts/contracts/strategies/sonic/SonicStakingStrategy.sol @@ -4,6 +4,7 @@ pragma solidity ^0.8.0; import { Math } from "@openzeppelin/contracts/utils/math/Math.sol"; import { IERC20, InitializableAbstractStrategy } from "../../utils/InitializableAbstractStrategy.sol"; import { SonicValidatorDelegator } from "./SonicValidatorDelegator.sol"; +import { IWrappedSonic } from "../../interfaces/sonic/IWrappedSonic.sol"; /** * @title Staking Strategy for Sonic's native S currency @@ -94,6 +95,10 @@ contract SonicStakingStrategy is SonicValidatorDelegator { /// This does not withdraw from delegated validators. That has to be done separately with `undelegate`. /// Any native S in this strategy will not be withdrawn. function withdrawAll() external override onlyVaultOrGovernor nonReentrant { + uint256 balance = address(this).balance; + if (balance > 0) { + IWrappedSonic(wrappedSonic).deposit{ value: balance }(); + } uint256 wSBalance = IERC20(wrappedSonic).balanceOf(address(this)); if (wSBalance > 0) { _withdraw(vaultAddress, wrappedSonic, wSBalance); diff --git a/contracts/contracts/strategies/sonic/SonicValidatorDelegator.sol b/contracts/contracts/strategies/sonic/SonicValidatorDelegator.sol index 202c5e1641..e32fc60854 100644 --- a/contracts/contracts/strategies/sonic/SonicValidatorDelegator.sol +++ b/contracts/contracts/strategies/sonic/SonicValidatorDelegator.sol @@ -260,6 +260,10 @@ abstract contract SonicValidatorDelegator is InitializableAbstractStrategy { /** * @notice To receive native S from SFC and Wrapped Sonic (wS) + * + * @dev This does not prevent donating S tokens to the contract + * as wrappedSonic has a `withdrawTo` function where a third party + * owner of wrappedSonic can withdraw to this contract. */ receive() external payable { require(