@@ -64,9 +64,9 @@ contract XanV1 is
6464    error ImplementationNotDelayed  (address  expected , address  actual );
6565
6666    error UpgradeNotScheduled  (address  impl );
67+     error UpgradeScheduledTwice  (address  impl );
6768    error UpgradeAlreadyScheduled  (address  impl , uint48  endTime );
6869    error UpgradeCancellationInvalid  (address  impl , uint48  endTime );
69-     error UpgradeIsNotAllowedToBeScheduledTwice  (address  impl );
7070
7171    error QuorumOrMinLockedSupplyNotReached  (address  impl );
7272    error QuorumAndMinLockedSupplyReached  (address  impl );
@@ -311,6 +311,11 @@ contract XanV1 is
311311        }
312312    }
313313
314+     /// @notice @inheritdoc IXanV1 
315+     function proposedImplementationsCount  () external  view  returns  (uint48  count ) {
316+         count =  _getVotingData ().implementationsCount ();
317+     }
318+ 
314319    /// @notice @inheritdoc IXanV1 
315320    function lockedSupply  () public  view  override  returns  (uint256  locked ) {
316321        locked =  _getLockingData ().lockedSupply;
@@ -415,13 +420,12 @@ contract XanV1 is
415420        bool  isScheduledByVoterBody =  (newImpl ==  votingData.scheduledImpl);
416421        bool  isScheduledByCouncil =  (newImpl ==  councilData.scheduledImpl);
417422
418-         // NOTE: councilUpgrade.impl and voterBodyUpgrade.impl can still be address(0); 
419- 
420-         if  (isScheduledByCouncil &&  isScheduledByVoterBody) {
421-             // This should never happen. 
422-             revert  UpgradeIsNotAllowedToBeScheduledTwice (newImpl);
423+         if  (isScheduledByVoterBody &&  isScheduledByCouncil) {
424+             // This state should never be reached. 
425+             revert  UpgradeScheduledTwice (newImpl);
423426        }
424427
428+         // Cache the best ranked implementation proposed by the voter body. 
425429        address  bestRankedVoterBodyImpl =  votingData.implementationByRank (0 );
426430
427431        if  (isScheduledByVoterBody) {
@@ -438,12 +442,14 @@ contract XanV1 is
438442        }
439443
440444        if  (isScheduledByCouncil) {
441-             // Revert if the quorum and minimum locked supply is reached for best ranked implementation proposed by 
442-             // the voter body. 
443-             if  (_isQuorumAndMinLockedSupplyReached (bestRankedVoterBodyImpl)) {
444-                 revert  QuorumAndMinLockedSupplyReached (bestRankedVoterBodyImpl);
445+             // Check if the best ranked implementation exists. 
446+             if  (bestRankedVoterBodyImpl !=  address (0 )) {
447+                 // Revert if the quorum and minimum locked supply is reached for best ranked implementation proposed by 
448+                 // the voter body and it could therefore could be scheduled. 
449+                 if  (_isQuorumAndMinLockedSupplyReached (bestRankedVoterBodyImpl)) {
450+                     revert  QuorumAndMinLockedSupplyReached (bestRankedVoterBodyImpl);
451+                 }
445452            }
446- 
447453            _checkDelayCriterion ({endTime: councilData.scheduledEndTime});
448454
449455            return ;
0 commit comments