-
Notifications
You must be signed in to change notification settings - Fork 392
Open
Description
When emitting emit UserPayment(msg.sender, amount, block.timestamp, block.timestamp + paymentExpirationTimeSeconds);, it should emit until = newExpiration
/**
* @notice Accepts payments and validates they meet the minimum requirement.
*/
receive() external payable {
uint256 amount = msg.value;
if (amount < amountToPayInWei) {
revert InvalidDepositAmount(amount, amountToPayInWei);
}
if (activeSubscriptionsAmount >= subscriptionLimit) {
revert SubscriptionLimitReached(subscriptionLimit);
}
if (subscribedAddresses[msg.sender] < block.timestamp) {
// Subscription is inactive/expired: start a new period from now.
subscribedAddresses[msg.sender] = block.timestamp + paymentExpirationTimeSeconds;
++activeSubscriptionsAmount;
} else {
// Subscription is still active: extend the current expiry by one period.
subscribedAddresses[msg.sender] = subscribedAddresses[msg.sender] + paymentExpirationTimeSeconds;
}
uint256 newExpiration = subscribedAddresses[msg.sender];
if (newExpiration - block.timestamp > maxSubscriptionTimeAhead) {
revert SubscriptionTimeExceedsLimit(newExpiration, maxSubscriptionTimeAhead);
}
emit UserPayment(msg.sender, amount, block.timestamp, block.timestamp + paymentExpirationTimeSeconds);
}
Metadata
Metadata
Assignees
Labels
No labels