@@ -14,6 +14,9 @@ contract AggregationModePaymentService is Initializable, OwnableUpgradeable, UUP
1414 /// @notice for how much time the payment is valid in seconds (86400s = 24hs)
1515 uint256 public constant PAYMENT_VALID_UNTIL_SECONDS = 86400 ;
1616
17+ /// @notice for how much time the payment is valid in seconds
18+ uint256 public paymentExpirationTimeSeconds;
19+
1720 /**
1821 * @notice Emitted when a user deposits funds to purchase service time.
1922 * @param user Address that sent the payment.
@@ -23,6 +26,10 @@ contract AggregationModePaymentService is Initializable, OwnableUpgradeable, UUP
2326 */
2427 event UserPayment (address user , uint256 indexed amount , uint256 indexed from , uint256 indexed until );
2528
29+ /// @notice Event emitted when the payment expiration time is updated
30+ /// @param newExpirationTime the new expiration time in seconds
31+ event PaymentExpirationTimeUpdated (uint256 indexed newExpirationTime );
32+
2633 error InvalidDepositAmount (uint256 amount );
2734
2835 /**
@@ -40,6 +47,8 @@ contract AggregationModePaymentService is Initializable, OwnableUpgradeable, UUP
4047 __Ownable_init ();
4148 __UUPSUpgradeable_init ();
4249 _transferOwnership (_owner);
50+
51+ paymentExpirationTimeSeconds = PAYMENT_VALID_UNTIL_SECONDS;
4352 }
4453
4554 /**
@@ -52,6 +61,16 @@ contract AggregationModePaymentService is Initializable, OwnableUpgradeable, UUP
5261 onlyOwner // solhint-disable-next-line no-empty-blocks
5362 {}
5463
64+ /**
65+ * @notice Ensures only the owner can authorize upgrades.
66+ * @param newExpirationTimeInSeconds The new expiration time for the users payments in seconds.
67+ */
68+ function setPaymentExpirationTimeSeconds (uint256 newExpirationTimeInSeconds ) public onlyOwner () {
69+ paymentExpirationTimeSeconds = newExpirationTimeInSeconds;
70+
71+ emit PaymentExpirationTimeUpdated (newExpirationTimeInSeconds);
72+ }
73+
5574 /**
5675 * @notice Accepts payments and validates they meet the minimum requirement.
5776 */
@@ -63,6 +82,6 @@ contract AggregationModePaymentService is Initializable, OwnableUpgradeable, UUP
6382 revert InvalidDepositAmount (amount);
6483 }
6584
66- emit UserPayment (msg .sender , amount, block .timestamp , block .timestamp + PAYMENT_VALID_UNTIL_SECONDS );
85+ emit UserPayment (msg .sender , amount, block .timestamp , block .timestamp + paymentExpirationTimeSeconds );
6786 }
6887}
0 commit comments