Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: log the last distributed amount #380

Merged
merged 3 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/CSFeeDistributor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ contract CSFeeDistributor is
}

STETH.transferShares(ACCOUNTING, sharesToDistribute);
emit FeeDistributed(nodeOperatorId, sharesToDistribute);
emit OperatorFeeDistributed(nodeOperatorId, sharesToDistribute);
}

/// @inheritdoc ICSFeeDistributor
Expand Down Expand Up @@ -121,6 +121,8 @@ contract CSFeeDistributor is
);
}

emit ModuleFeeDistributed(distributed);

// NOTE: Make sure off-chain tooling provides a distinct CID of a log even for empty reports, e.g. by mixing
// in a frame identifier such as reference slot to a file.
if (bytes(_logCid).length == 0) revert InvalidLogCID();
Expand Down
8 changes: 7 additions & 1 deletion src/interfaces/ICSFeeDistributor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ pragma solidity 0.8.24;

interface ICSFeeDistributor is IAssetRecovererLib {
/// @dev Emitted when fees are distributed
event FeeDistributed(uint256 indexed nodeOperatorId, uint256 shares);
event OperatorFeeDistributed(
uint256 indexed nodeOperatorId,
uint256 shares
);

/// @dev Emitted when distribution data is updated
event DistributionDataUpdated(
Expand All @@ -20,6 +23,9 @@ interface ICSFeeDistributor is IAssetRecovererLib {
/// @dev Emitted when distribution log is updated
event DistributionLogUpdated(string logCid);

/// @dev It logs how many shares were distributed in the latest report
event ModuleFeeDistributed(uint256 shares);

error ZeroAccountingAddress();
error ZeroStEthAddress();
error ZeroAdminAddress();
Expand Down
5 changes: 4 additions & 1 deletion test/CSFeeDistributor.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ contract CSFeeDistributorTest is CSFeeDistributorTestBase {
);

vm.expectEmit(true, true, true, true, address(feeDistributor));
emit ICSFeeDistributor.FeeDistributed(nodeOperatorId, shares);
emit ICSFeeDistributor.OperatorFeeDistributed(nodeOperatorId, shares);

vm.prank(address(accounting));
feeDistributor.distributeFees({
Expand Down Expand Up @@ -419,6 +419,9 @@ contract CSFeeDistributorTest is CSFeeDistributorTestBase {
treeCid
);

vm.expectEmit(true, true, true, true, address(feeDistributor));
emit ICSFeeDistributor.ModuleFeeDistributed(shares);

vm.expectEmit(true, true, true, true, address(feeDistributor));
emit ICSFeeDistributor.DistributionLogUpdated(logCid);

Expand Down
Loading