Skip to content

Commit b79bd9f

Browse files
committed
chore: address contract lints
1 parent 7e52fa8 commit b79bd9f

File tree

1 file changed

+30
-4
lines changed

1 file changed

+30
-4
lines changed

contracts/src/core/AggregationModePaymentService.sol

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,56 @@ import {Initializable} from "@openzeppelin-upgrades/contracts/proxy/utils/Initia
55
import {OwnableUpgradeable} from "@openzeppelin-upgrades/contracts/access/OwnableUpgradeable.sol";
66
import {UUPSUpgradeable} from "@openzeppelin-upgrades/contracts/proxy/utils/UUPSUpgradeable.sol";
77

8+
/**
9+
* @title AggregationModePaymentService
10+
* @author Aligned Layer
11+
* @notice Handles deposits that grant time-limited access to aggregation services.
12+
*/
813
contract AggregationModePaymentService is Initializable, OwnableUpgradeable, UUPSUpgradeable {
9-
// 24hs
10-
uint256 constant paymentValidUntilSeconds = 86400;
14+
/// @notice for how much time the payment is valid in seconds (86400s = 24hs)
15+
uint256 public constant PAYMENT_VALID_UNTIL_SECONDS = 86400;
1116

12-
event UserPayment(address user, uint256 amount, uint256 from, uint256 until);
17+
/**
18+
* @notice Emitted when a user deposits funds to purchase service time.
19+
* @param user Address that sent the payment.
20+
* @param amount Native token amount paid.
21+
* @param from Timestamp when the payment was recorded.
22+
* @param until Timestamp until when the payment is valid.
23+
*/
24+
event UserPayment(address user, uint256 indexed amount, uint256 indexed from, uint256 indexed until);
1325

1426
error InvalidDepositAmount(uint256 amount);
1527

28+
/**
29+
* @notice Disables initializers for the implementation contract.
30+
*/
1631
constructor() {
1732
_disableInitializers();
1833
}
1934

35+
/**
36+
* @notice Initializes the contract and transfers ownership to the provided address.
37+
* @param _owner Address that becomes the contract owner.
38+
*/
2039
function initialize(address _owner) public initializer {
2140
__Ownable_init();
2241
__UUPSUpgradeable_init();
2342
_transferOwnership(_owner);
2443
}
2544

45+
/**
46+
* @notice Ensures only the owner can authorize upgrades.
47+
* @param newImplementation Address of the new implementation contract.
48+
*/
2649
function _authorizeUpgrade(address newImplementation)
2750
internal
2851
override
2952
onlyOwner // solhint-disable-next-line no-empty-blocks
3053
{}
3154

55+
/**
56+
* @notice Accepts payments and validates they meet the minimum requirement.
57+
*/
3258
receive() external payable {
3359
uint256 amount = msg.value;
3460

@@ -37,6 +63,6 @@ contract AggregationModePaymentService is Initializable, OwnableUpgradeable, UUP
3763
revert InvalidDepositAmount(amount);
3864
}
3965

40-
emit UserPayment(msg.sender, amount, block.timestamp, block.timestamp + paymentValidUntilSeconds);
66+
emit UserPayment(msg.sender, amount, block.timestamp, block.timestamp + PAYMENT_VALID_UNTIL_SECONDS);
4167
}
4268
}

0 commit comments

Comments
 (0)