Skip to content

Commit 978a79b

Browse files
committed
feat: mock out new events for EigenPodManager
1 parent 5f544d9 commit 978a79b

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

src/contracts/interfaces/IEigenPodManager.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ interface IEigenPodManager is IPausable {
2323
event BeaconChainETHDeposited(address indexed podOwner, uint256 amount);
2424

2525
/// @notice Emitted when the balance of an EigenPod is updated
26-
event PodSharesUpdated(address indexed podOwner, int256 sharesDelta);
26+
event PodSharesUpdated(address indexed podOwner, IEigenPod indexed pod, int256 newTotalShares, int256 sharesDelta);
2727

2828
/// @notice Emitted when a withdrawal of beacon chain ETH is completed
2929
event BeaconChainETHWithdrawalCompleted(

src/contracts/pods/EigenPodManager.sol

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ contract EigenPodManager is
134134
});
135135
}
136136
}
137-
emit PodSharesUpdated(podOwner, sharesDelta);
137+
emit PodSharesUpdated(podOwner, ownerToPod[podOwner], updatedPodOwnerShares, sharesDelta);
138138
}
139139

140140
/**
@@ -155,6 +155,8 @@ contract EigenPodManager is
155155
int256 updatedPodOwnerShares = podOwnerShares[podOwner] - int256(shares);
156156
require(updatedPodOwnerShares >= 0, "EigenPodManager.removeShares: cannot result in pod owner having negative shares");
157157
podOwnerShares[podOwner] = updatedPodOwnerShares;
158+
159+
emit PodSharesUpdated(podOwner, ownerToPod[podOwner], updatedPodOwnerShares, -int256(shares));
158160
}
159161

160162
/**
@@ -175,7 +177,7 @@ contract EigenPodManager is
175177
int256 updatedPodOwnerShares = currentPodOwnerShares + int256(shares);
176178
podOwnerShares[podOwner] = updatedPodOwnerShares;
177179

178-
emit PodSharesUpdated(podOwner, int256(shares));
180+
emit PodSharesUpdated(podOwner, ownerToPod[podOwner], updatedPodOwnerShares, int256(shares));
179181

180182
return uint256(_calculateChangeInDelegatableShares({sharesBefore: currentPodOwnerShares, sharesAfter: updatedPodOwnerShares}));
181183
}
@@ -197,6 +199,7 @@ contract EigenPodManager is
197199
require(int256(shares) >= 0, "EigenPodManager.withdrawSharesAsTokens: shares cannot be negative");
198200
require(shares % GWEI_TO_WEI == 0, "EigenPodManager.withdrawSharesAsTokens: shares must be a whole Gwei amount");
199201
int256 currentPodOwnerShares = podOwnerShares[podOwner];
202+
IEigenPod pod = ownerToPod[podOwner];
200203

201204
// if there is an existing shares deficit, prioritize decreasing the deficit first
202205
if (currentPodOwnerShares < 0) {
@@ -205,16 +208,17 @@ contract EigenPodManager is
205208
if (shares > currentShareDeficit) {
206209
podOwnerShares[podOwner] = 0;
207210
shares -= currentShareDeficit;
208-
emit PodSharesUpdated(podOwner, int256(currentShareDeficit));
211+
emit PodSharesUpdated(podOwner, pod, 0, int256(currentShareDeficit));
209212
// otherwise get rid of as much deficit as possible, and return early, since there is nothing left over to forward on
210213
} else {
211-
podOwnerShares[podOwner] += int256(shares);
212-
emit PodSharesUpdated(podOwner, int256(shares));
214+
int256 updatedPodOwnerShares = podOwnerShares[podOwner] + int256(shares);
215+
podOwnerShares[podOwner] = updatedPodOwnerShares;
216+
emit PodSharesUpdated(podOwner, pod, updatedPodOwnerShares, int256(shares));
213217
return;
214218
}
215219
}
216220
// Actually withdraw to the destination
217-
ownerToPod[podOwner].withdrawRestakedBeaconChainETH(destination, shares);
221+
pod.withdrawRestakedBeaconChainETH(destination, shares);
218222
}
219223

220224
// INTERNAL FUNCTIONS

0 commit comments

Comments
 (0)