Skip to content
Closed
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
10 changes: 5 additions & 5 deletions src/base/MultiStrategyDistributionManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,15 @@ contract MultiStrategyDistributionManager is AbstractDistributionManager {
emit StrategiesInitialized(_strategies);
}

/// @notice Checks if distribution is ready based on cycle completion, votes, recipients, strategies, and yield
/// @return ready True if cycle is complete, there are votes, recipients, configured strategies, and sufficient yield
/// @notice Checks if conditions are met for distribution (cycle complete, recipients configured, sufficient yield)
/// @return ready True if cycle is complete, there are recipients, configured strategies, and sufficient yield
/// @dev Allows zero-voter distributions for small communities (matches breadchain contracts)
function isDistributionReady() public view override returns (bool ready) {
if (cycleManager().distributionManager() != address(this)) return false;
if (!cycleManager().isCycleComplete()) return false;

uint256 totalVotes = getTotalCurrentVotingPower();
if (totalVotes == 0) return false;

// Allow zero-voter distributions — small communities may legitimately have no votes
// but still want to distribute to recipients (e.g., fixed grants).
uint256 recipientCount = recipientRegistry().getRecipientCount();
if (recipientCount == 0) return false;

Comment on lines 85 to 93
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the totalVotes == 0 gate removed, isDistributionReady() can return true even when configured strategies will revert on zero votes (e.g., VotingDistributionStrategy reverts with NoVotes). This can cause automation to repeatedly attempt claimAndDistribute() and revert. Consider either (a) keeping a conservative zero-votes check unless the manager is explicitly configured to allow it, or (b) introducing a strategy-level readiness signal/interface so vote-dependent strategies can block readiness.

Copilot uses AI. Check for mistakes.
Expand Down
4 changes: 3 additions & 1 deletion src/interfaces/IDistributionManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ interface IDistributionManager {
error ZeroAddress();

/// @notice Thrown when distribution conditions are not met
/// @dev Distribution is not ready when voting power is 0 or yield < recipient count
/// @dev Distribution is not ready when cycle is incomplete, there are no recipients,
/// or yield is insufficient. Note: MultiStrategyDistributionManager allows
/// zero-voter distributions for fixed-grant use cases.
Comment on lines +16 to +18
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The devdoc on DistributionNotReady describes readiness conditions as if they were universal, but BaseDistributionManager.isDistributionReady() still returns false when total voting power is 0. Consider making this comment implementation-agnostic (e.g., “conditions vary by implementation; common reasons include …”) and move the MultiStrategy-specific note to MultiStrategyDistributionManager docs.

Suggested change
/// @dev Distribution is not ready when cycle is incomplete, there are no recipients,
/// or yield is insufficient. Note: MultiStrategyDistributionManager allows
/// zero-voter distributions for fixed-grant use cases.
/// @dev Readiness conditions vary by implementation. Common reasons include an
/// incomplete cycle, no eligible recipients, insufficient available yield,
/// or other implementation-specific requirements not being satisfied.

Copilot uses AI. Check for mistakes.
error DistributionNotReady();

/// @notice Thrown when there is no yield available to distribute
Expand Down