@@ -14,10 +14,11 @@ interface IScheduler is SchedulerEvents {
1414 * @notice Adds a new subscription
1515 * @param subscriptionParams The parameters for the subscription
1616 * @return subscriptionId The ID of the newly created subscription
17+ * @dev Requires msg.value to be at least the minimum balance for the subscription
1718 */
1819 function addSubscription (
1920 SchedulerState.SubscriptionParams calldata subscriptionParams
20- ) external returns (uint256 subscriptionId );
21+ ) external payable returns (uint256 subscriptionId );
2122
2223 /**
2324 * @notice Gets a subscription's parameters and status
@@ -45,11 +46,7 @@ interface IScheduler is SchedulerEvents {
4546 SchedulerState.SubscriptionParams calldata newSubscriptionParams
4647 ) external ;
4748
48- /**
49- * @notice Deactivates a subscription
50- * @param subscriptionId The ID of the subscription to deactivate
51- */
52- function deactivateSubscription (uint256 subscriptionId ) external ;
49+ // Deactivation is now handled through updateSubscription by setting isActive to false
5350
5451 /**
5552 * @notice Updates price feeds for a subscription.
@@ -64,16 +61,36 @@ interface IScheduler is SchedulerEvents {
6461 bytes32 [] calldata priceIds
6562 ) external ;
6663
67- /**
68- * @notice Gets the latest prices for a subscription
69- * @param subscriptionId The ID of the subscription
70- * @param priceIds Optional array of price IDs to retrieve. If empty, returns all price feeds for the subscription.
71- * @return The latest price feeds for the requested price IDs
64+ /** @notice Returns the price of a price feed without any sanity checks.
65+ * @dev This function returns the most recent price update in this contract without any recency checks.
66+ * This function is unsafe as the returned price update may be arbitrarily far in the past.
67+ *
68+ * Users of this function should check the `publishTime` in the price to ensure that the returned price is
69+ * sufficiently recent for their application. If you are considering using this function, it may be
70+ * safer / easier to use `getPriceNoOlderThan`.
71+ * @return prices - please read the documentation of PythStructs.Price to understand how to use this safely.
72+ */
73+ function getPricesUnsafe (
74+ uint256 subscriptionId ,
75+ bytes32 [] calldata priceIds
76+ ) external view returns (PythStructs.Price[] memory prices );
77+
78+ /** @notice Returns the exponentially-weighted moving average price of a price feed without any sanity checks.
79+ * @dev This function returns the same price as `getEmaPrice` in the case where the price is available.
80+ * However, if the price is not recent this function returns the latest available price.
81+ *
82+ * The returned price can be from arbitrarily far in the past; this function makes no guarantees that
83+ * the returned price is recent or useful for any particular application.
84+ *
85+ * Users of this function should check the `publishTime` in the price to ensure that the returned price is
86+ * sufficiently recent for their application. If you are considering using this function, it may be
87+ * safer / easier to use either `getEmaPrice` or `getEmaPriceNoOlderThan`.
88+ * @return price - please read the documentation of PythStructs.Price to understand how to use this safely.
7289 */
73- function getLatestPrices (
90+ function getEmaPriceUnsafe (
7491 uint256 subscriptionId ,
7592 bytes32 [] calldata priceIds
76- ) external view returns (PythStructs.PriceFeed [] memory );
93+ ) external view returns (PythStructs.Price [] memory price );
7794
7895 /**
7996 * @notice Adds funds to a subscription's balance
@@ -82,23 +99,40 @@ interface IScheduler is SchedulerEvents {
8299 function addFunds (uint256 subscriptionId ) external payable ;
83100
84101 /**
85- * @notice Withdraws funds from a subscription's balance
102+ * @notice Withdraws funds from a subscription's balance.
103+ * @dev A minimum balance must be maintained for active subscriptions. To withdraw past
104+ * the minimum balance limit, deactivate the subscription first.
86105 * @param subscriptionId The ID of the subscription
87106 * @param amount The amount to withdraw
88107 */
89108 function withdrawFunds (uint256 subscriptionId , uint256 amount ) external ;
90109
110+ /**
111+ * @notice Returns the minimum balance an active subscription of a given size needs to hold.
112+ * @param numPriceFeeds The number of price feeds in the subscription.
113+ */
114+ function getMinimumBalance (
115+ uint8 numPriceFeeds
116+ ) external view returns (uint256 minimumBalanceInWei );
117+
91118 /**
92119 * @notice Gets all active subscriptions with their parameters
93120 * @dev This function has no access control to allow keepers to discover active subscriptions
121+ * @param startIndex The starting index for pagination
122+ * @param maxResults The maximum number of results to return
94123 * @return subscriptionIds Array of active subscription IDs
95124 * @return subscriptionParams Array of subscription parameters for each active subscription
125+ * @return totalCount Total number of active subscriptions
96126 */
97- function getActiveSubscriptions ()
127+ function getActiveSubscriptions (
128+ uint256 startIndex ,
129+ uint256 maxResults
130+ )
98131 external
99132 view
100133 returns (
101134 uint256 [] memory subscriptionIds ,
102- SchedulerState.SubscriptionParams[] memory subscriptionParams
135+ SchedulerState.SubscriptionParams[] memory subscriptionParams ,
136+ uint256 totalCount
103137 );
104138}
0 commit comments