@@ -56,15 +56,28 @@ struct SubscriptionParams {
5656}
5757```
5858
59+ ### SubscriptionStatus
60+
61+ This struct tracks the current status of a Pulse subscription:
62+
63+ ``` solidity
64+ struct SubscriptionStatus {
65+ uint256 priceLastUpdatedAt; // Timestamp of the last update. All feeds in the subscription are updated together.
66+ uint256 balanceInWei; // Balance that will be used to fund the subscription's upkeep.
67+ uint256 totalUpdates; // Tracks update count across all feeds in the subscription (increments by number of feeds per update)
68+ uint256 totalSpent; // Counter of total fees paid for subscription upkeep in wei.
69+ }
70+ ```
71+
5972### UpdateCriteria
6073
6174This struct defines when price feeds should be updated:
6275
6376``` solidity
6477struct UpdateCriteria {
65- bool updateOnHeartbeat; // Update based on time elapsed
78+ bool updateOnHeartbeat; // Should update based on time elapsed
6679 uint32 heartbeatSeconds; // Time interval for heartbeat updates
67- bool updateOnDeviation; // Update based on price deviation
80+ bool updateOnDeviation; // Should update on price deviation
6881 uint32 deviationThresholdBps; // Price deviation threshold in basis points
6982}
7083```
@@ -93,13 +106,19 @@ uint256 minBalance = pulse.getMinimumBalance(uint8(params.priceIds.length));
93106uint256 subscriptionId = pulse.createSubscription{value: minBalance}(params);
94107```
95108
109+ ## Updating a Subscription
110+
111+ You can update an existing subscription's parameters using the ` updateSubscription ` method. Only the subscription manager (the address that created it) can update a subscription, and permanent subscriptions cannot be updated afterwards.
112+
96113## Reading Price Feeds
97114
98115``` solidity
99116bytes32[] memory priceIds = new bytes32[](1);
100117priceIds[0] = bytes32(...); // Pyth price feed ID
101118
102- PythStructs.Price[] memory prices = pulse.getPricesUnsafe(subscriptionId, priceIds);
119+ // Specify maximum age in seconds (e.g., 300 seconds = 5 minutes)
120+ uint256 maxAge = 300;
121+ PythStructs.Price[] memory prices = pulse.getPricesNoOlderThan(subscriptionId, priceIds, maxAge);
103122
104123// Access price data
105124int64 price = prices[0].price;
0 commit comments