88 setBalance,
99 setStorageAt,
1010} = require ( "@nomicfoundation/hardhat-network-helpers" ) ;
11- const { isCI } = require ( "../helpers" ) ;
11+ const { isCI, getAssetAddresses } = require ( "../helpers" ) ;
1212const { shouldBehaveLikeGovernable } = require ( "../behaviour/governable" ) ;
1313const { shouldBehaveLikeStrategy } = require ( "../behaviour/strategy" ) ;
1414const { MAX_UINT256 , ZERO_BYTES32 } = require ( "../../utils/constants" ) ;
@@ -143,12 +143,11 @@ describe("Unit test: Compounding SSV Staking Strategy", function () {
143143 it ( "SSV network should have allowance to spend SSV tokens of the strategy" , async ( ) => {
144144 const { compoundingStakingSSVStrategy, ssv } = fixture ;
145145
146- const ssvNetworkAddress =
147- await compoundingStakingSSVStrategy . SSV_NETWORK ( ) ;
146+ const ssvNetworkAddress = await getAssetAddresses ( deployments ) ;
148147 await expect (
149148 await ssv . allowance (
150149 compoundingStakingSSVStrategy . address ,
151- ssvNetworkAddress
150+ ssvNetworkAddress . SSVNetwork
152151 )
153152 ) . to . equal ( MAX_UINT256 ) ;
154153 } ) ;
@@ -1864,7 +1863,7 @@ describe("Unit test: Compounding SSV Staking Strategy", function () {
18641863 } ) ;
18651864
18661865 it ( "Should withdraw ETH from the strategy, no ETH" , async ( ) => {
1867- const { compoundingStakingSSVStrategy, weth, josh } = fixture ;
1866+ const { compoundingStakingSSVStrategy, weth, josh, oethVault } = fixture ;
18681867
18691868 const depositAmount = parseEther ( "10" ) ;
18701869 await weth
@@ -1879,7 +1878,7 @@ describe("Unit test: Compounding SSV Staking Strategy", function () {
18791878
18801879 const withdrawTx = compoundingStakingSSVStrategy
18811880 . connect ( sVault )
1882- . withdraw ( josh . address , weth . address , depositAmount ) ;
1881+ . withdraw ( oethVault . address , weth . address , depositAmount ) ;
18831882
18841883 await expect ( withdrawTx )
18851884 . to . emit ( compoundingStakingSSVStrategy , "Withdrawal" )
@@ -1898,7 +1897,13 @@ describe("Unit test: Compounding SSV Staking Strategy", function () {
18981897 } ) ;
18991898
19001899 it ( "Should withdraw ETH from the strategy, withdraw some ETH" , async ( ) => {
1901- const { compoundingStakingSSVStrategy, weth, josh } = fixture ;
1900+ const {
1901+ compoundingStakingSSVStrategy,
1902+ weth,
1903+ josh,
1904+ oethVault,
1905+ validatorRegistrator,
1906+ } = fixture ;
19021907
19031908 const depositAmount = parseEther ( "10" ) ;
19041909 await weth
@@ -1915,9 +1920,9 @@ describe("Unit test: Compounding SSV Staking Strategy", function () {
19151920 await compoundingStakingSSVStrategy . checkBalance ( weth . address ) ;
19161921
19171922 const withdrawTx = compoundingStakingSSVStrategy
1918- . connect ( sVault )
1923+ . connect ( validatorRegistrator )
19191924 . withdraw (
1920- josh . address ,
1925+ oethVault . address ,
19211926 weth . address ,
19221927 depositAmount . add ( parseEther ( "5" ) )
19231928 ) ;
@@ -1970,7 +1975,17 @@ describe("Unit test: Compounding SSV Staking Strategy", function () {
19701975 weth . address ,
19711976 parseEther ( "10" )
19721977 )
1973- ) . to . be . revertedWith ( "Must specify recipient" ) ;
1978+ ) . to . be . revertedWith ( "Recipient not Vault" ) ;
1979+ } ) ;
1980+
1981+ it ( "Should revert when withdrawing to a user" , async ( ) => {
1982+ const { compoundingStakingSSVStrategy, weth, josh } = fixture ;
1983+
1984+ await expect (
1985+ compoundingStakingSSVStrategy
1986+ . connect ( sVault )
1987+ . withdraw ( josh . address , weth . address , parseEther ( "10" ) )
1988+ ) . to . be . revertedWith ( "Recipient not Vault" ) ;
19741989 } ) ;
19751990
19761991 it ( "Should withdrawAll ETH from the strategy, no ETH" , async ( ) => {
0 commit comments