@@ -320,6 +320,10 @@ contract RocketMegapoolDelegate is RocketMegapoolDelegateBase, RocketMegapoolDel
320320 nodeBond += assignedNodeBond;
321321 userQueuedCapital -= assignedUserCapital;
322322 nodeQueuedBond -= assignedNodeBond;
323+ // Store capital ratio on first assignment
324+ if (lastDistributionTime == 0 ) {
325+ _calculateAndSaveCapitalRatio ();
326+ }
323327 // Delete prestake signature for a small gas refund (no longer needed)
324328 delete prestakeSignatures[_validatorId];
325329 // Emit event
@@ -335,7 +339,7 @@ contract RocketMegapoolDelegate is RocketMegapoolDelegateBase, RocketMegapoolDel
335339 require (validator.inPrestake, "Validator must be pre-staked " );
336340 // Store last requested value for later
337341 uint32 lastRequestedValue = validator.lastRequestedValue;
338- // Snapshot capital ratio (sets lastDistributionTime on first validator)
342+ // Snapshot capital ratio
339343 _snapshotCapitalRatio ();
340344 // Account for assigned value
341345 uint256 assignedUsed = lastRequestedValue * milliToWei - prestakeValue;
@@ -772,13 +776,18 @@ contract RocketMegapoolDelegate is RocketMegapoolDelegateBase, RocketMegapoolDel
772776 return RocketNodeDepositInterface (rocketStorage.getAddress (rocketNodeDepositKey));
773777 }
774778
775- /// @dev Calculates the current capital ratio of this Megapool and notifies RocketNetworkRevenues to snapshot it
776- /// Attempts to distribute rewards at current ratio before snapshotting
779+ /// @dev Attempts to distribute rewards at current ratio before snapshotting capital ratio
777780 function _snapshotCapitalRatio () internal {
778781 // Try to distribute rewards before updating capital ratio
779782 if (numExitingValidators == 0 && numLockedValidators == 0 ) {
780783 _distributeAmount (getPendingRewards ());
781784 }
785+ // Snapshot capital ratio
786+ _calculateAndSaveCapitalRatio ();
787+ }
788+
789+ /// @dev Calculates the current capital ratio of this Megapool and notifies RocketNetworkRevenues to snapshot it
790+ function _calculateAndSaveCapitalRatio () internal {
782791 // Calculate and send capital ratio to RocketNetworkRevenues for snapshotting
783792 RocketNetworkRevenuesInterface rocketNetworkRevenues = RocketNetworkRevenuesInterface (getContractAddress ("rocketNetworkRevenues " ));
784793 if (nodeBond + userCapital > 0 ) {
0 commit comments