Skip to content

Commit 9595158

Browse files
Improve the subscriptions amount name to active ones
1 parent e5dee48 commit 9595158

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

contracts/scripts/anvil/state/alignedlayer-deployed-anvil-state.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

contracts/src/core/AggregationModePaymentService.sol

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ contract AggregationModePaymentService is Initializable, UUPSUpgradeable, Access
2828
uint256 public subscriptionLimit;
2929

3030
/// @notice Number of current subscriptions
31-
uint256 public subscriptionsAmount;
31+
uint256 public activeSubscriptionsAmount;
3232

3333
/// @notice Maximum amount of time (in seconds) an address can be subscribed ahead of the current block timestamp.
3434
/// Prevents stacking multiple short subscriptions and paying them over an extended period.
@@ -61,7 +61,7 @@ contract AggregationModePaymentService is Initializable, UUPSUpgradeable, Access
6161

6262
/// @notice Event emitted when the subscription amount is updated
6363
/// @param newSubscriptionsAmount the new subscriptions amount.
64-
event SubscriptionsAmountUpdated(uint256 indexed newSubscriptionsAmount);
64+
event ActiveSubscriptionsAmountUpdated(uint256 indexed newSubscriptionsAmount);
6565

6666
/// @notice Event emitted when the max subscription time ahead is updated
6767
/// @param newMaxSubscriptionTimeAhead the max time allowed to subscribe ahead the current timestamp.
@@ -173,10 +173,10 @@ contract AggregationModePaymentService is Initializable, UUPSUpgradeable, Access
173173
* @notice Sets the subscriptions counter to the value received by parameter. Only callable by the owner
174174
* @param newSubscriptionsAmount The new subscriptions amount.
175175
*/
176-
function setSubscriptionsAmount(uint256 newSubscriptionsAmount) public onlyRole(ADMIN_ROLE) {
177-
subscriptionsAmount = newSubscriptionsAmount;
176+
function setActiveSubscriptionsAmount(uint256 newSubscriptionsAmount) public onlyRole(ADMIN_ROLE) {
177+
activeSubscriptionsAmount = newSubscriptionsAmount;
178178

179-
emit SubscriptionsAmountUpdated(newSubscriptionsAmount);
179+
emit ActiveSubscriptionsAmountUpdated(newSubscriptionsAmount);
180180
}
181181

182182
/**
@@ -202,7 +202,7 @@ contract AggregationModePaymentService is Initializable, UUPSUpgradeable, Access
202202

203203
subscribedAddresses[addressToAdd] = expirationTimestamp;
204204

205-
++subscriptionsAmount;
205+
++activeSubscriptionsAmount;
206206

207207
emit UserPayment(addressToAdd, amountToPayInWei, block.timestamp, expirationTimestamp);
208208
}
@@ -218,7 +218,7 @@ contract AggregationModePaymentService is Initializable, UUPSUpgradeable, Access
218218
revert InvalidDepositAmount(amount, amountToPayInWei);
219219
}
220220

221-
if (subscriptionsAmount >= subscriptionLimit) {
221+
if (activeSubscriptionsAmount >= subscriptionLimit) {
222222
revert SubscriptionLimitReached(subscriptionLimit);
223223
}
224224

@@ -236,7 +236,7 @@ contract AggregationModePaymentService is Initializable, UUPSUpgradeable, Access
236236
revert SubscriptionTimeExceedsLimit(newExpiration, maxSubscriptionTimeAhead);
237237
}
238238

239-
++subscriptionsAmount;
239+
++activeSubscriptionsAmount;
240240

241241
emit UserPayment(msg.sender, amount, block.timestamp, block.timestamp + paymentExpirationTimeSeconds);
242242
}

0 commit comments

Comments
 (0)