Skip to content

Commit 9624d4a

Browse files
committed
fix: merge, format
1 parent 2d1bc74 commit 9624d4a

File tree

5 files changed

+30
-12
lines changed

5 files changed

+30
-12
lines changed

target_chains/ethereum/contracts/contracts/pulse/Scheduler.sol

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ abstract contract Scheduler is IScheduler, SchedulerState, SchedulerConstants {
4646

4747
// Check deposit limit for permanent subscriptions
4848
if (subscriptionParams.isPermanent && msg.value > MAX_DEPOSIT_LIMIT) {
49-
revert MaxDepositLimitExceeded();
49+
revert SchedulerErrors.MaxDepositLimitExceeded();
5050
}
5151

5252
// Set subscription to active
@@ -597,20 +597,18 @@ abstract contract Scheduler is IScheduler, SchedulerState, SchedulerConstants {
597597
/// BALANCE MANAGEMENT
598598

599599
function addFunds(uint256 subscriptionId) external payable override {
600-
SubscriptionParams storage params = _state.subscriptionParams[
601-
subscriptionId
602-
];
603-
SubscriptionStatus storage status = _state.subscriptionStatuses[
604-
subscriptionId
605-
];
600+
SchedulerStructs.SubscriptionParams storage params = _state
601+
.subscriptionParams[subscriptionId];
602+
SchedulerStructs.SubscriptionStatus storage status = _state
603+
.subscriptionStatuses[subscriptionId];
606604

607605
if (!params.isActive) {
608-
revert InactiveSubscription();
606+
revert SchedulerErrors.InactiveSubscription();
609607
}
610608

611609
// Check deposit limit for permanent subscriptions
612610
if (params.isPermanent && msg.value > MAX_DEPOSIT_LIMIT) {
613-
revert MaxDepositLimitExceeded();
611+
revert SchedulerErrors.MaxDepositLimitExceeded();
614612
}
615613

616614
status.balanceInWei += msg.value;
@@ -621,7 +619,7 @@ abstract contract Scheduler is IScheduler, SchedulerState, SchedulerConstants {
621619
uint8(params.priceIds.length)
622620
);
623621
if (status.balanceInWei < minimumBalance) {
624-
revert InsufficientBalance();
622+
revert SchedulerErrors.InsufficientBalance();
625623
}
626624
}
627625
}

target_chains/ethereum/pulse_sdk/solidity/SchedulerConstants.sol

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ contract SchedulerConstants {
88
uint8 public constant MAX_PRICE_IDS_PER_SUBSCRIPTION = 255;
99
/// Maximum number of addresses in the reader whitelist
1010
uint8 public constant MAX_READER_WHITELIST_SIZE = 255;
11+
/// Maximum deposit limit for permanent subscriptions in wei
12+
uint256 public constant MAX_DEPOSIT_LIMIT = 100 ether;
1113

1214
/// Maximum time in the past (relative to current block timestamp)
1315
/// for which a price update timestamp is considered valid

target_chains/ethereum/pulse_sdk/solidity/SchedulerErrors.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,10 @@ pragma solidity ^0.8.0;
44

55
library SchedulerErrors {
66
// Authorization errors
7-
87
/// 0x82b42900
98
error Unauthorized();
109

1110
// Subscription state errors
12-
1311
/// 0xe7262b66
1412
error InactiveSubscription();
1513
/// 0xf4d678b8
@@ -56,4 +54,6 @@ library SchedulerErrors {
5654
// Payment errors
5755
/// 0xec58cd53
5856
error KeeperPaymentFailed();
57+
/// 0x82fcf1e2
58+
error MaxDepositLimitExceeded();
5959
}

target_chains/ethereum/pulse_sdk/solidity/abis/SchedulerConstants.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,19 @@
2525
"stateMutability": "view",
2626
"type": "function"
2727
},
28+
{
29+
"inputs": [],
30+
"name": "MAX_DEPOSIT_LIMIT",
31+
"outputs": [
32+
{
33+
"internalType": "uint256",
34+
"name": "",
35+
"type": "uint256"
36+
}
37+
],
38+
"stateMutability": "view",
39+
"type": "function"
40+
},
2841
{
2942
"inputs": [],
3043
"name": "MAX_PRICE_IDS_PER_SUBSCRIPTION",

target_chains/ethereum/pulse_sdk/solidity/abis/SchedulerErrors.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,11 @@
8383
"name": "KeeperPaymentFailed",
8484
"type": "error"
8585
},
86+
{
87+
"inputs": [],
88+
"name": "MaxDepositLimitExceeded",
89+
"type": "error"
90+
},
8691
{
8792
"inputs": [],
8893
"name": "PriceSlotMismatch",

0 commit comments

Comments
 (0)