Skip to content

Commit

Permalink
fix: log the last distributed amount
Browse files Browse the repository at this point in the history
  • Loading branch information
madlabman committed Jan 13, 2025
1 parent 28cc335 commit bce7c74
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/CSFeeDistributor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ contract CSFeeDistributor is
);
}

emit LastDistributed(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
3 changes: 3 additions & 0 deletions src/interfaces/ICSFeeDistributor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,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 LastDistributed(uint256 shares);

error ZeroAccountingAddress();
error ZeroStEthAddress();
error ZeroAdminAddress();
Expand Down
3 changes: 3 additions & 0 deletions test/CSFeeDistributor.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,9 @@ contract CSFeeDistributorTest is CSFeeDistributorTestBase {
treeCid
);

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

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

Expand Down

0 comments on commit bce7c74

Please sign in to comment.