@@ -339,7 +339,7 @@ contract SchedulerTest is Test, SchedulerEvents, PulseSchedulerTestUtils {
339339 {
340340 // Setup subscription with heartbeat criteria
341341 uint32 heartbeatSeconds = 60 ; // 60 second heartbeat
342- SchedulerState .UpdateCriteria memory criteria = SchedulerState
342+ SchedulerStructs .UpdateCriteria memory criteria = SchedulerStructs
343343 .UpdateCriteria ({
344344 updateOnHeartbeat: true ,
345345 heartbeatSeconds: heartbeatSeconds,
@@ -376,7 +376,7 @@ contract SchedulerTest is Test, SchedulerEvents, PulseSchedulerTestUtils {
376376 ) = _setupSubscriptionAndFirstUpdate ();
377377
378378 // Verify priceLastUpdatedAt is set
379- (, SchedulerState .SubscriptionStatus memory status ) = scheduler
379+ (, SchedulerStructs .SubscriptionStatus memory status ) = scheduler
380380 .getSubscription (subscriptionId);
381381 assertEq (
382382 status.priceLastUpdatedAt,
@@ -385,11 +385,11 @@ contract SchedulerTest is Test, SchedulerEvents, PulseSchedulerTestUtils {
385385 );
386386
387387 // 2. Update subscription to add price IDs
388- (SchedulerState .SubscriptionParams memory currentParams , ) = scheduler
388+ (SchedulerStructs .SubscriptionParams memory currentParams , ) = scheduler
389389 .getSubscription (subscriptionId);
390390 bytes32 [] memory newPriceIds = createPriceIds (3 );
391391
392- SchedulerState .SubscriptionParams memory newParams = currentParams;
392+ SchedulerStructs .SubscriptionParams memory newParams = currentParams;
393393 newParams.priceIds = newPriceIds;
394394
395395 // Update the subscription
@@ -422,7 +422,7 @@ contract SchedulerTest is Test, SchedulerEvents, PulseSchedulerTestUtils {
422422 scheduler.updatePriceFeeds (subscriptionId, updateData);
423423
424424 // Verify the update was processed
425- (, SchedulerState .SubscriptionStatus memory status ) = scheduler
425+ (, SchedulerStructs .SubscriptionStatus memory status ) = scheduler
426426 .getSubscription (subscriptionId);
427427 assertEq (
428428 status.priceLastUpdatedAt,
@@ -438,7 +438,9 @@ contract SchedulerTest is Test, SchedulerEvents, PulseSchedulerTestUtils {
438438
439439 // This should fail because we haven't waited for heartbeatSeconds since the last update
440440 vm.expectRevert (
441- abi.encodeWithSelector (UpdateConditionsNotMet.selector )
441+ abi.encodeWithSelector (
442+ SchedulerErrors.UpdateConditionsNotMet.selector
443+ )
442444 );
443445 vm.prank (pusher);
444446 scheduler.updatePriceFeeds (subscriptionId, updateData);
@@ -668,14 +670,14 @@ contract SchedulerTest is Test, SchedulerEvents, PulseSchedulerTestUtils {
668670 );
669671
670672 // Get subscription parameters and calculate minimum balance
671- (SchedulerState .SubscriptionParams memory params , ) = scheduler
673+ (SchedulerStructs .SubscriptionParams memory params , ) = scheduler
672674 .getSubscription (subscriptionId);
673675 uint256 minimumBalance = scheduler.getMinimumBalance (
674676 uint8 (params.priceIds.length )
675677 );
676678
677679 // Deactivate the subscription
678- SchedulerState .SubscriptionParams memory testParams = params;
680+ SchedulerStructs .SubscriptionParams memory testParams = params;
679681 testParams.isActive = false ;
680682 scheduler.updateSubscription (subscriptionId, testParams);
681683
@@ -685,8 +687,8 @@ contract SchedulerTest is Test, SchedulerEvents, PulseSchedulerTestUtils {
685687
686688 // Verify balance is now below minimum
687689 (
688- SchedulerState .SubscriptionParams memory testUpdatedParams ,
689- SchedulerState .SubscriptionStatus memory testUpdatedStatus
690+ SchedulerStructs .SubscriptionParams memory testUpdatedParams ,
691+ SchedulerStructs .SubscriptionStatus memory testUpdatedStatus
690692 ) = scheduler.getSubscription (subscriptionId);
691693 assertEq (
692694 testUpdatedStatus.balanceInWei,
@@ -695,12 +697,18 @@ contract SchedulerTest is Test, SchedulerEvents, PulseSchedulerTestUtils {
695697 );
696698
697699 // Try to add funds to inactive subscription (should fail with InactiveSubscription)
698- vm.expectRevert (abi.encodeWithSelector (InactiveSubscription.selector ));
700+ vm.expectRevert (
701+ abi.encodeWithSelector (
702+ SchedulerErrors.InactiveSubscription.selector
703+ )
704+ );
699705 scheduler.addFunds {value: 1 wei }(subscriptionId);
700706
701707 // Try to reactivate with insufficient balance (should fail)
702708 testUpdatedParams.isActive = true ;
703- vm.expectRevert (abi.encodeWithSelector (InsufficientBalance.selector ));
709+ vm.expectRevert (
710+ abi.encodeWithSelector (SchedulerErrors.InsufficientBalance.selector )
711+ );
704712 scheduler.updateSubscription (subscriptionId, testUpdatedParams);
705713 }
706714
@@ -710,7 +718,7 @@ contract SchedulerTest is Test, SchedulerEvents, PulseSchedulerTestUtils {
710718 2 ,
711719 address (reader)
712720 );
713- (SchedulerState .SubscriptionParams memory params , ) = scheduler
721+ (SchedulerStructs .SubscriptionParams memory params , ) = scheduler
714722 .getSubscription (subscriptionId);
715723 uint256 minimumBalance = scheduler.getMinimumBalance (
716724 uint8 (params.priceIds.length )
@@ -742,7 +750,7 @@ contract SchedulerTest is Test, SchedulerEvents, PulseSchedulerTestUtils {
742750 // Verify balance is now below minimum
743751 (
744752 ,
745- SchedulerState .SubscriptionStatus memory statusAfterUpdates
753+ SchedulerStructs .SubscriptionStatus memory statusAfterUpdates
746754 ) = scheduler.getSubscription (subscriptionId);
747755 assertTrue (
748756 statusAfterUpdates.balanceInWei < minimumBalance,
@@ -754,7 +762,9 @@ contract SchedulerTest is Test, SchedulerEvents, PulseSchedulerTestUtils {
754762 uint256 insufficientFunds = minimumBalance -
755763 statusAfterUpdates.balanceInWei -
756764 1 ;
757- vm.expectRevert (abi.encodeWithSelector (InsufficientBalance.selector ));
765+ vm.expectRevert (
766+ abi.encodeWithSelector (SchedulerErrors.InsufficientBalance.selector )
767+ );
758768 scheduler.addFunds {value: insufficientFunds}(subscriptionId);
759769
760770 // Add sufficient funds to get back above minimum
@@ -766,7 +776,7 @@ contract SchedulerTest is Test, SchedulerEvents, PulseSchedulerTestUtils {
766776 // Verify balance is now above minimum
767777 (
768778 ,
769- SchedulerState .SubscriptionStatus memory statusAfterAddingFunds
779+ SchedulerStructs .SubscriptionStatus memory statusAfterAddingFunds
770780 ) = scheduler.getSubscription (subscriptionId);
771781 assertTrue (
772782 statusAfterAddingFunds.balanceInWei >= minimumBalance,
@@ -1033,16 +1043,18 @@ contract SchedulerTest is Test, SchedulerEvents, PulseSchedulerTestUtils {
10331043
10341044 function testPermanentSubscriptionDepositLimit () public {
10351045 // Test 1: Creating a permanent subscription with deposit exceeding MAX_DEPOSIT_LIMIT should fail
1036- SchedulerState .SubscriptionParams
1046+ SchedulerStructs .SubscriptionParams
10371047 memory params = createDefaultSubscriptionParams (2 , address (reader));
10381048 params.isPermanent = true ;
10391049
1040- uint256 maxDepositLimit = 100 ether ; // Same as MAX_DEPOSIT_LIMIT in SchedulerState
1050+ uint256 maxDepositLimit = scheduler. MAX_DEPOSIT_LIMIT ();
10411051 uint256 excessiveDeposit = maxDepositLimit + 1 ether ;
10421052 vm.deal (address (this ), excessiveDeposit);
10431053
10441054 vm.expectRevert (
1045- abi.encodeWithSelector (MaxDepositLimitExceeded.selector )
1055+ abi.encodeWithSelector (
1056+ SchedulerErrors.MaxDepositLimitExceeded.selector
1057+ )
10461058 );
10471059 scheduler.createSubscription {value: excessiveDeposit}(params);
10481060
@@ -1056,8 +1068,8 @@ contract SchedulerTest is Test, SchedulerEvents, PulseSchedulerTestUtils {
10561068
10571069 // Verify subscription was created correctly
10581070 (
1059- SchedulerState .SubscriptionParams memory storedParams ,
1060- SchedulerState .SubscriptionStatus memory status
1071+ SchedulerStructs .SubscriptionParams memory storedParams ,
1072+ SchedulerStructs .SubscriptionStatus memory status
10611073 ) = scheduler.getSubscription (subscriptionId);
10621074
10631075 assertTrue (
@@ -1075,13 +1087,15 @@ contract SchedulerTest is Test, SchedulerEvents, PulseSchedulerTestUtils {
10751087 vm.deal (address (this ), largeAdditionalFunds);
10761088
10771089 vm.expectRevert (
1078- abi.encodeWithSelector (MaxDepositLimitExceeded.selector )
1090+ abi.encodeWithSelector (
1091+ SchedulerErrors.MaxDepositLimitExceeded.selector
1092+ )
10791093 );
10801094 scheduler.addFunds {value: largeAdditionalFunds}(subscriptionId);
10811095
10821096 // Test 4: Adding funds to a permanent subscription within MAX_DEPOSIT_LIMIT should succeed
10831097 // Create a non-permanent subscription to test partial funding
1084- SchedulerState .SubscriptionParams
1098+ SchedulerStructs .SubscriptionParams
10851099 memory nonPermanentParams = createDefaultSubscriptionParams (
10861100 2 ,
10871101 address (reader)
@@ -1104,7 +1118,7 @@ contract SchedulerTest is Test, SchedulerEvents, PulseSchedulerTestUtils {
11041118 // Verify funds were added correctly
11051119 (
11061120 ,
1107- SchedulerState .SubscriptionStatus memory nonPermanentStatus
1121+ SchedulerStructs .SubscriptionStatus memory nonPermanentStatus
11081122 ) = scheduler.getSubscription (nonPermanentSubId);
11091123
11101124 assertEq (
@@ -1117,7 +1131,7 @@ contract SchedulerTest is Test, SchedulerEvents, PulseSchedulerTestUtils {
11171131 uint256 largeDeposit = maxDepositLimit * 2 ;
11181132 vm.deal (address (this ), largeDeposit);
11191133
1120- SchedulerState .SubscriptionParams
1134+ SchedulerStructs .SubscriptionParams
11211135 memory unlimitedParams = createDefaultSubscriptionParams (
11221136 2 ,
11231137 address (reader)
@@ -1127,8 +1141,10 @@ contract SchedulerTest is Test, SchedulerEvents, PulseSchedulerTestUtils {
11271141 }(unlimitedParams);
11281142
11291143 // Verify subscription was created with the large deposit
1130- (, SchedulerState.SubscriptionStatus memory unlimitedStatus ) = scheduler
1131- .getSubscription (unlimitedSubId);
1144+ (
1145+ ,
1146+ SchedulerStructs.SubscriptionStatus memory unlimitedStatus
1147+ ) = scheduler.getSubscription (unlimitedSubId);
11321148
11331149 assertEq (
11341150 unlimitedStatus.balanceInWei,
@@ -2439,7 +2455,7 @@ contract SchedulerTest is Test, SchedulerEvents, PulseSchedulerTestUtils {
24392455 bytes32 removedPriceId = initialPriceIds[numInitialFeeds - 1 ];
24402456
24412457 // 2. Action: Update subscription to remove the last price feed
2442- (SchedulerState .SubscriptionParams memory params , ) = scheduler
2458+ (SchedulerStructs .SubscriptionParams memory params , ) = scheduler
24432459 .getSubscription (subscriptionId);
24442460
24452461 // Create new price IDs array without the last ID
@@ -2456,7 +2472,7 @@ contract SchedulerTest is Test, SchedulerEvents, PulseSchedulerTestUtils {
24562472
24572473 // 3. Verification:
24582474 // - Verify that the removed price ID is no longer part of the subscription's price IDs
2459- (SchedulerState .SubscriptionParams memory updatedParams , ) = scheduler
2475+ (SchedulerStructs .SubscriptionParams memory updatedParams , ) = scheduler
24602476 .getSubscription (subscriptionId);
24612477 assertEq (
24622478 updatedParams.priceIds.length ,
@@ -2490,7 +2506,7 @@ contract SchedulerTest is Test, SchedulerEvents, PulseSchedulerTestUtils {
24902506 removedIdArray[0 ] = removedPriceId;
24912507 vm.expectRevert (
24922508 abi.encodeWithSelector (
2493- InvalidPriceId.selector ,
2509+ SchedulerErrors. InvalidPriceId.selector ,
24942510 removedPriceId,
24952511 bytes32 (0 )
24962512 )
@@ -2508,21 +2524,21 @@ contract SchedulerTest is Test, SchedulerEvents, PulseSchedulerTestUtils {
25082524 );
25092525
25102526 // 2. Prepare params with too many price IDs (MAX_PRICE_IDS_PER_SUBSCRIPTION + 1)
2511- (SchedulerState .SubscriptionParams memory currentParams , ) = scheduler
2527+ (SchedulerStructs .SubscriptionParams memory currentParams , ) = scheduler
25122528 .getSubscription (subscriptionId);
25132529
25142530 uint16 tooManyFeeds = uint16 (
25152531 scheduler.MAX_PRICE_IDS_PER_SUBSCRIPTION ()
25162532 ) + 1 ;
25172533 bytes32 [] memory tooManyPriceIds = createPriceIds (tooManyFeeds);
25182534
2519- SchedulerState .SubscriptionParams memory newParams = currentParams;
2535+ SchedulerStructs .SubscriptionParams memory newParams = currentParams;
25202536 newParams.priceIds = tooManyPriceIds;
25212537
25222538 // 3. Expect revert when trying to update with too many price IDs
25232539 vm.expectRevert (
25242540 abi.encodeWithSelector (
2525- TooManyPriceIds.selector ,
2541+ SchedulerErrors. TooManyPriceIds.selector ,
25262542 tooManyFeeds,
25272543 scheduler.MAX_PRICE_IDS_PER_SUBSCRIPTION ()
25282544 )
0 commit comments