@@ -338,6 +338,10 @@ contract IntegrationCheckUtils is IntegrationBase {
338
338
ALLOCATION MANAGER CHECKS
339
339
*******************************************************************************/
340
340
341
+ function _calculateSlippage (uint256 x , uint256 y , uint256 z ) internal pure returns (uint256 r ) {
342
+ return mulmod (x, y, z) > 0 ? 1 : 0 ;
343
+ }
344
+
341
345
function check_Withdrawal_AsTokens_State_AfterSlash (
342
346
User staker ,
343
347
User operator ,
@@ -348,19 +352,23 @@ contract IntegrationCheckUtils is IntegrationBase {
348
352
) internal {
349
353
IERC20 [] memory tokens = new IERC20 [](withdrawal.strategies.length );
350
354
351
- for (uint256 i; i < withdrawal.strategies.length ; i++ ) {
355
+ for (uint i; i < withdrawal.strategies.length ; i++ ) {
352
356
IStrategy strat = withdrawal.strategies[i];
353
357
354
358
bool isBeaconChainETHStrategy = strat == beaconChainETHStrategy;
355
359
356
360
tokens[i] = isBeaconChainETHStrategy ? NATIVE_ETH : withdrawal.strategies[i].underlyingToken ();
357
361
358
362
if (slashingParams.strategies.contains (strat)) {
359
- uint256 wadToSlash = slashingParams.wadsToSlash[slashingParams.strategies.indexOf (strat)];
363
+ uint wadToSlash = slashingParams.wadsToSlash[slashingParams.strategies.indexOf (strat)];
360
364
361
365
expectedTokens[i] -= expectedTokens[i]
362
366
.mulWadRoundUp (allocateParams.newMagnitudes[i].mulWadRoundUp (wadToSlash));
363
367
368
+ uint256 max = allocationManager.getMaxMagnitude (address (operator), strat);
369
+
370
+ withdrawal.scaledShares[i] -= withdrawal.scaledShares[i].calcSlashedAmount (WAD, max);
371
+
364
372
// Round down to the nearest gwei for beaconchain ETH strategy.
365
373
if (isBeaconChainETHStrategy) {
366
374
expectedTokens[i] -= expectedTokens[i] % 1 gwei ;
0 commit comments