Skip to content

Commit

Permalink
fix: revert last poc
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnyonline committed Sep 28, 2024
1 parent 2918a37 commit 9803beb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
2 changes: 0 additions & 2 deletions .gas-snapshot

This file was deleted.

11 changes: 4 additions & 7 deletions src/ynEIGEN/EigenStrategyManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -341,9 +341,8 @@ contract EigenStrategyManager is
for (uint256 j = 0; j < assetsCount; j++) {

uint256 strategiesBalance;
// uint256 strategiesWithdrawalQueueBalance;
uint256 strategiesWithdrawalQueueBalance;
uint256 strategiesWithdrawnBalance;
uint256 totalQueuedShares;
IERC20 asset = assets[j];
IStrategy strategy = strategies[asset];
for (uint256 i; i < nodesCount; i++ ) {
Expand All @@ -353,9 +352,8 @@ contract EigenStrategyManager is

(uint256 queuedShares, uint256 strategyWithdrawnBalance) = node.getQueuedSharesAndWithdrawn(strategy, asset);

if (queuedShares > 0) { // @todo - remove from inner loop
// strategiesWithdrawalQueueBalance += strategy.sharesToUnderlyingView(queuedShares);
totalQueuedShares += queuedShares; // @note - this actually costs more gas!
if (queuedShares > 0) {
strategiesWithdrawalQueueBalance += strategy.sharesToUnderlyingView(queuedShares);
}

strategiesWithdrawnBalance += strategyWithdrawnBalance;
Expand All @@ -364,8 +362,7 @@ contract EigenStrategyManager is
DynamicArrayLib.set(
stakedBalances,
j,
// wrapper.toUserAssetAmount(asset, strategiesBalance + strategiesWithdrawalQueueBalance) + strategiesWithdrawnBalance
wrapper.toUserAssetAmount(asset, strategiesBalance + strategy.sharesToUnderlyingView(totalQueuedShares)) + strategiesWithdrawnBalance
wrapper.toUserAssetAmount(asset, strategiesBalance + strategiesWithdrawalQueueBalance) + strategiesWithdrawnBalance
);
}

Expand Down
4 changes: 2 additions & 2 deletions src/ynEIGEN/TokenStakingNode.sol
Original file line number Diff line number Diff line change
Expand Up @@ -204,13 +204,13 @@ contract TokenStakingNode is
uint256 _delta = _actualAmountOut > _expectedAmountOut ?
_actualAmountOut - _expectedAmountOut :
_expectedAmountOut - _actualAmountOut;
if (_delta > 2) revert WithdrawalAmountMismatch(); // @todo - might be a footgun
if (_delta > 2) revert WithdrawalAmountMismatch(); // @todo - remove this (bc of slashing)

IWrapper _wrapper = IYieldNestStrategyManager(tokenStakingNodesManager.yieldNestStrategyManager()).wrapper();
IERC20(_token).forceApprove(address(_wrapper), _actualAmountOut); // NOTE: approving also token that will not be transferred
(_actualAmountOut, _token) = _wrapper.wrap(_actualAmountOut, _token);

queuedShares[_strategy] -= _shares;
queuedShares[_strategy] -= _shares; // @todo - how to account for slashing (where we have less shares than what was originally recorded)?
withdrawn[_token] += _actualAmountOut;

emit CompletedQueuedWithdrawals(_shares, _actualAmountOut, address(_strategy));
Expand Down

0 comments on commit 9803beb

Please sign in to comment.