@@ -4,7 +4,6 @@ pragma solidity ^0.8.20;
44import "@openzeppelin/contracts/token/ERC20/IERC20.sol " ;
55import "@openzeppelin/contracts/utils/StorageSlot.sol " ;
66import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol " ;
7- import "forge-std/console.sol " ;
87
98/**
109 * @title ValidatorLogic
@@ -119,8 +118,6 @@ contract ValidatorLogic {
119118 */
120119 function unstake (uint256 amount ) external onlyFactory returns (uint256 totalUnstaked ) {
121120 uint256 stakeSlot = StorageSlot.getUint256Slot (STAKE_AMOUNT_SLOT).value;
122- console.log ("stakeSlot before unstake " , stakeSlot);
123- console.log ("positions length " , getValidatorPositionsLength (getValidatorOwner ()));
124121 if (amount > stakeSlot) revert InsufficientStakeAmount ();
125122
126123 totalUnstaked = _unstake (getValidatorOwner (), amount, stakeSlot);
@@ -286,7 +283,6 @@ contract ValidatorLogic {
286283
287284 setStakingPosition (positionId, position);
288285 pushValidatorPosition (owner, positionId);
289- console.log ("create posId " , positionId, "amount " , amount);
290286 emit StakingPositionCreated (owner, positionId, amount);
291287 return positionId;
292288 }
@@ -302,21 +298,17 @@ contract ValidatorLogic {
302298 uint256 totalPositions = getValidatorPositionsLength (validator);
303299 uint256 remaining = amount;
304300 uint256 unstaked = 0 ;
305- console.log ("totalPositions " , totalPositions);
306301
307302 // LIFO: start from the last position
308303 for (uint256 i = totalPositions; i > 0 && remaining > 0 ;) {
309304 uint256 posId = getValidatorPosition (validator, i - 1 );
310- console.log ("index " , i - 1 );
311- console.log ("posId " , posId);
312305 if (posId == 0 ) {
313306 unchecked {
314307 i-- ;
315308 }
316309 continue ;
317310 }
318311 StakingPosition memory pos = getStakingPosition (posId);
319- console.log ("pos.amount before " , pos.amount);
320312 if (pos.amount == 0 ) {
321313 // Remove this position from the array to avoid stale posIds
322314 deleteValidatorPosition (validator, i - 1 );
@@ -327,12 +319,9 @@ contract ValidatorLogic {
327319 }
328320
329321 uint256 toUnstake = pos.amount > remaining ? remaining : pos.amount;
330- console.log ("toUnstake " , toUnstake);
331322 pos.amount -= toUnstake;
332323 remaining -= toUnstake;
333324 unstaked += toUnstake;
334- console.log ("pos.amount after " , pos.amount);
335- console.log ("remaining " , remaining);
336325
337326 if (pos.amount == 0 ) {
338327 _deleteStakingPosition (posId);
0 commit comments