Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make LinkMonitor CLA compatible #11427

Closed
wants to merge 130 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
130 commits
Select commit Hold shift + click to select a range
1a1f9ac
include add and remove to/from watchlist
Nov 30, 2023
9ffe94a
add RBAC to LinkMon
Dec 1, 2023
64f4753
add imported contracts
Dec 4, 2023
c7fd9d0
first batch of fixes
Dec 5, 2023
228f559
add tests
Dec 5, 2023
e0ab2dc
minor reviews
Dec 14, 2023
0979edd
VRF-765: make optional to cancel subs after test run for VRF WASP tes…
iljapavlovs Nov 24, 2023
54e1214
Call proper loop for outOfSyncLoop exist on close test (#11384)
dhaidashenko Nov 27, 2023
0b11c90
VRF-543: add test for verifying round robin for multiple sending keys…
iljapavlovs Nov 27, 2023
2077cfd
core/internal/cltest: simplify (#11383)
jmank88 Nov 27, 2023
d424b11
bump various deps (#11357)
jmank88 Nov 27, 2023
96fa461
Upkeep Balance Monitor (#11180)
RyanRHall Nov 27, 2023
af29432
Bump chainlink-automation version (#11380)
amirylm Nov 27, 2023
ead3beb
[Functions] Heartbeat request support in Gateway handlers (#11345)
bolekk Nov 27, 2023
b490a85
Remove core logger from common (#11366)
dimriou Nov 27, 2023
bb46971
Remove FriendlyNumber function (#11376)
dimriou Nov 28, 2023
956148b
feat: log poller for vrf v2/v2+ (#11174)
makramkd Nov 28, 2023
6883879
plugins/cmd/chainlink-median: move to chainlink-feeds (#11270)
jmank88 Nov 28, 2023
f64ec3a
Soft migration to Generalize Multinode client for EVM BCI-2286 (#11369)
dhaidashenko Nov 28, 2023
b48e81e
Add loud error for failure to get the solana sha (#11400)
tateexon Nov 28, 2023
12a3b3f
Feed LatestPrice query cache (#11326)
samsondav Nov 28, 2023
0001b81
Make job names less dynamic for required checks (#11403)
chainchad Nov 28, 2023
d5de32c
core/logger: sanitize escape chars in console logs (#11402)
jmank88 Nov 28, 2023
deb72f6
core/config: add EVM.OCR DeltaCOverride and DeltaCJitterOverride (#11…
jmank88 Nov 28, 2023
cd4dff5
release/2.7.1 -> develop (#11370)
snehaagni Nov 28, 2023
2651da7
[BCI-2235] Abandoned Transaction Tracking (#11143)
DylanTinianov Nov 29, 2023
795d62e
Change UseFinalityTags to FinalityTagEnabled in CHANGELOG.md to avoid…
reductionista Nov 29, 2023
deec7e6
Add callWithExactGas lib (#11009)
RensR Nov 29, 2023
128dba4
CCIP-1336 LogPoller - Bunch of minor improvements (#11348)
mateusz-sekara Nov 29, 2023
fbd844c
Only enforce ctf version on merge_group push to develop (#11389)
tateexon Nov 29, 2023
9b6d6c8
core/services/chainlink: skip P2P Peer Wrapper when unused (#11411)
jmank88 Nov 29, 2023
4300d40
Update CleanupChainTables shell cmd to specify schema (#11409)
ilija42 Nov 29, 2023
bd039dc
embed Solana & Feeds LOOPPs; adjust CI (#11401)
jmank88 Nov 29, 2023
cd08494
Change difficulty from Big to BigInt (#11388)
dimriou Nov 29, 2023
b7cb603
core/chains/evm/txmgr: nil check errs before wrapping (#11412)
jmank88 Nov 29, 2023
5c4e368
.github/workflows: notify slack for ci-core develop failues (#11408)
jmank88 Nov 29, 2023
4f5a3f8
Add PendingSequenceAt to fix txm test case (#11416)
dimriou Nov 29, 2023
d6465f0
core/chains/evm/txmgr: fix TestTxm_Reset mocks (#11420)
jmank88 Nov 30, 2023
7f1a336
Gateway client script: added readme and json pretty print (#11361)
Nov 30, 2023
01f8398
[BCF-2779] Better formatting of the generic plugin config (#11406)
cedric-cordenier Nov 30, 2023
f034241
Add VRFOwner contract support to VRF V2 Super Script (#11414)
kidambisrinivas Nov 30, 2023
f2f2e35
RE-2081 All core metrics dashboard for CRIB (#11396)
skudasov Nov 30, 2023
47132bf
Update Test Go and CTF Version (#11413)
kalverra Nov 30, 2023
a2ef90e
core/chains/evm/config/toml/defaults: fix sepolia link address (#11426)
jmank88 Nov 30, 2023
73334d1
Fix telemetry manager health report (#11397)
george-dorin Nov 30, 2023
cc260b0
Increase blocks number for mercury v1 to 10 (#11410)
samsondav Nov 30, 2023
2a216cb
[BCI-2151] Refactor prom reporter db API (#11394)
DylanTinianov Nov 30, 2023
fa2834d
FUN-1130: Move Functions Coordinator v1.1 to production folder (#11431)
justinkaseman Nov 30, 2023
963efe0
Bump chainlink-testing-framework to get postgres ecr changes (#11435)
tateexon Nov 30, 2023
64b1b0e
Improve randomize testdb sequences (#11433)
ilija42 Nov 30, 2023
2804d8e
Refactor evm registry packages (#11374)
ferglor Nov 30, 2023
8ae5190
core/services/chainlink: pass static ver & sha to HealtChecker (#11432)
jmank88 Nov 30, 2023
cdd5700
[chore] Refactor ResultsRunSaver to not expose runResults (#11398)
cedric-cordenier Dec 1, 2023
f136035
[AUTO-7451] Move load test and smoke test to use new actions (#11364)
anirudhwarrier Dec 1, 2023
532a9d4
Fix keystore enable to upsert, now restores accidentally deleted keys…
ilija42 Dec 1, 2023
43604c1
upgrade cosmos gogoproto (#10879)
poopoothegorilla Dec 1, 2023
bc5c3fa
Add NOTE for enum duplication and todo to resovle it (#11444)
infiloop2 Dec 1, 2023
6ffc0d9
Fix keystore enable to upsert, now restores accidentally deleted keys…
patrickhuie19 Dec 1, 2023
037c86b
bump golang.org/x/... (#10449)
jmank88 Dec 1, 2023
1b20f8a
Delete unused custom telemetry files (#11441)
infiloop2 Dec 1, 2023
73696e7
Small cleanup in mercury v0.3 request code (#11442)
infiloop2 Dec 1, 2023
3f25ba7
Adjust price scaling factor from 1e8 => 1e18 (#11447)
samsondav Dec 1, 2023
4b60e6e
core/services/synchronization: track go routines to block close (#11443)
jmank88 Dec 1, 2023
282bd60
[Functions] Fix heartbeat handler test (#11449)
bolekk Dec 1, 2023
c74b403
mercury cache fixes (#11448)
samsondav Dec 1, 2023
26bf6da
Prep for CRIB (#11418)
chainchad Dec 1, 2023
d2bbc37
make streams lookup modular (#11368)
shileiwill Dec 1, 2023
a933ba1
write test for backwards compatibility in automation report encoding …
RyanRHall Dec 1, 2023
e2b4652
remove previous Solidity code owners (#11454)
se3000 Dec 1, 2023
10b9d44
common/txmgr: initialize map before goroutines race ahead (#11452)
jmank88 Dec 1, 2023
bb5a451
Use correct image name prefix for repo (#11465)
chainchad Dec 1, 2023
5dbcf77
Rename Functions Client i_router to i_functionsRouter (#11450)
justinkaseman Dec 1, 2023
5fab4f7
Bump version and update CHANGELOG for core v2.8.0 (#11419)
snehaagni Dec 1, 2023
7f89813
[AUTO-7471] add automation node upgrade test to nightly CI (#11469)
anirudhwarrier Dec 4, 2023
e360c6d
core/services/relay/evm/mercury: use chainlink-data-streams (#11293)
jmank88 Dec 4, 2023
17cc63d
[AUTO-7471] add notification to automation-nightly-test (#11473)
anirudhwarrier Dec 4, 2023
c22b082
Fix solhint warnings (#11480)
RensR Dec 4, 2023
5bfe1fa
bump libocr; remove P2P.V1; drop libp2p (#10872)
jmank88 Dec 4, 2023
a9b7ea0
Revert "make streams lookup modular (#11368)" (#11482)
shileiwill Dec 4, 2023
03a8fed
Update Loki auth in Github test workflow (#11488)
kidambisrinivas Dec 4, 2023
1ea4908
remove pkgerrors dependency from common pkg (#11479)
poopoothegorilla Dec 5, 2023
8f65343
Extract mathutil (#11446)
dimriou Dec 5, 2023
4848878
VRF-784: add contract loader client for BSC to run CTF tests there (#…
iljapavlovs Dec 5, 2023
b4d8dc3
Check if ECR image exists before trying to publish (#11495)
chainchad Dec 5, 2023
c12f27c
VRF-782: Fix setup-env script in order to include flag for deploying …
iljapavlovs Dec 5, 2023
40422d0
BCF-2823 Minor changes to distributeFunds (#11476)
ilija42 Dec 6, 2023
2ae33d9
Create auto update workflow (#11483)
DylanTinianov Dec 6, 2023
624c6d6
[TT-744] Bump core results output filter (#11486)
tateexon Dec 6, 2023
7f5ce41
Interfaces and skeleton methods for ChainReader EVM POC (#10990)
reductionista Dec 6, 2023
c121be1
Improve logging for cache (#11453)
samsondav Dec 6, 2023
0ee838d
Only run keepers tests in the merge_group for PRs to develop (#11506)
tateexon Dec 6, 2023
d095984
[FUN-1094] Minor fixes (#11434)
agparadiso Dec 6, 2023
5748ac5
[TT-523] Add Networks for Live Tests (#11358)
kalverra Dec 7, 2023
3c9c19c
Devspace non-root/build update (#11510)
skudasov Dec 7, 2023
66653e4
bump mockery to v2.38.0 (#11509)
jmank88 Dec 7, 2023
cefb1c6
Test VRF LogPoller functionality- initializeLastProcessedBlock, updat…
kidambisrinivas Dec 7, 2023
6e677d9
EVM Extraction core/services/servicetest (#11514)
DylanTinianov Dec 7, 2023
a093bbe
[TT-590] Logstream with buffered streaming to Loki (#11477)
Tofel Dec 7, 2023
d315f6e
go generate a mermaid flowchart for org modules (#11467)
jmank88 Dec 8, 2023
c2eb539
use servicetest.Run & RunHealthy (#11354)
jmank88 Dec 8, 2023
dc1ffae
bump go to 1.21.5 and misc deps (#11525)
jmank88 Dec 8, 2023
f70b596
core/scripts/common: rm ava-labs/coreth; lint (#11451)
jmank88 Dec 8, 2023
23bc61e
(test): Remove unnecessary fuzzing from Functions OnTokenTransfer tes…
justinkaseman Dec 8, 2023
3babdf9
small improvements based on comments (#11491)
shileiwill Dec 8, 2023
dca584a
wrap devspace commands (#11530)
skudasov Dec 11, 2023
c90bd0c
go.mods: rm libp2p; rm btcd replace (#11502)
jmank88 Dec 11, 2023
87f83c0
[BCF-2760] Flakey test detection improvements (#11470)
cedric-cordenier Dec 12, 2023
69dc8df
Remove core utils dependencies from common (#11425)
dimriou Dec 12, 2023
ce4e858
Use multiple EL clients with ocrv2 median smoke test (#11399)
Tofel Dec 12, 2023
f378e88
disable kaniko fallback, increase deploy wait timeout (#11548)
skudasov Dec 12, 2023
c5459c6
[DEPLOY-178]: Adds Scroll L2EP Contracts (#11405)
chris-de-leon-cll Dec 12, 2023
fdb4aa7
Handle edge case involving blocks not being found in the db (#11298)
reductionista Dec 12, 2023
ec3b4d8
Remove big from core utils (#11511)
dimriou Dec 12, 2023
be23511
bump toml/v2 and prometheus to latest patch (#11541)
jmank88 Dec 12, 2023
769357f
Change keepers to use the default contract transmitter (#11308)
ferglor Dec 12, 2023
dc7c3de
Standardize LP filter logging (#11515)
connorwstein Dec 12, 2023
67764ce
bump Foundry to the December release (#11540)
RensR Dec 13, 2023
20d6129
Removes Optimism Goerli from Scheduled Tests (#11559)
kalverra Dec 13, 2023
8c3f9f7
fix health monitoring (#11558)
jmank88 Dec 13, 2023
be1e436
[FUN-990] s4 observability improvements (#11512)
agparadiso Dec 13, 2023
91870ca
[TT-367] [TT-745] Quick and Dirty OCRv2 Soak Test (#11487)
kalverra Dec 13, 2023
ffbce92
bump common; use SugaredLogger methods (#11556)
jmank88 Dec 13, 2023
2154535
VRF-798: fix "nonce too low" in load test setup when creating a subsc…
iljapavlovs Dec 13, 2023
a0ee2d1
feat: add liquidity balancer specs table (#11564)
makramkd Dec 13, 2023
5b351ab
Auto 8087 modular streams (#11489)
shileiwill Dec 13, 2023
00e5b57
Adds MAKE Command for Building Plugin Image (#11567)
kalverra Dec 13, 2023
5162325
Mercury Packer (#11521)
shileiwill Dec 13, 2023
d50b439
Introduce job spec flag for custom reverted pipeline (#11529)
kidambisrinivas Dec 13, 2023
ddf1249
options to include customized pg and chainlink image (#11570)
AnieeG Dec 13, 2023
c223fdf
add readme (#11535)
shileiwill Dec 14, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@

pragma solidity 0.8.19;

import {AccessControl} from "../../vendor/openzeppelin-solidity/v4.8.3/contracts/access/AccessControl.sol";
fbac marked this conversation as resolved.
Show resolved Hide resolved
import {AutomationCompatibleInterface} from "../interfaces/AutomationCompatibleInterface.sol";
import {ConfirmedOwner} from "../../shared/access/ConfirmedOwner.sol";
import {IERC20} from "../../vendor/openzeppelin-solidity/v4.8.3/contracts/token/ERC20/IERC20.sol";
import {Pausable} from "../../vendor/openzeppelin-solidity/v4.8.3/contracts/security/Pausable.sol";

interface IAggregatorProxy {
function aggregator() external view returns (address);
Expand Down Expand Up @@ -33,7 +32,7 @@ interface ILinkAvailable {
/// this is a "trusless" upkeep, meaning it does not trust the caller of performUpkeep;
/// we could save a fair amount of gas and re-write this upkeep for use with Automation v2.0+,
/// which has significantly different trust assumptions
contract LinkAvailableBalanceMonitor is ConfirmedOwner, Pausable, AutomationCompatibleInterface {
fbac marked this conversation as resolved.
Show resolved Hide resolved
contract LinkAvailableBalanceMonitor is AccessControl, AutomationCompatibleInterface {
event BalanceUpdated(address indexed addr, uint256 oldBalance, uint256 newBalance);
event FundsWithdrawn(uint256 amountWithdrawn, address payee);
event UpkeepIntervalSet(uint256 oldUpkeepInterval, uint256 newUpkeepInterval);
Expand Down Expand Up @@ -63,30 +62,54 @@ contract LinkAvailableBalanceMonitor is ConfirmedOwner, Pausable, AutomationComp
bool isActive;
}

bytes32 public constant ADMIN_ROLE = keccak256("ADMIN_ROLE");
bytes32 public constant EXECUTOR_ROLE = keccak256("EXECUTOR_ROLE");
uint96 private constant DEFAULT_TOP_UP_AMOUNT = 9;
uint96 private constant DEFAULT_MIN_BALANCE = 1;
fbac marked this conversation as resolved.
Show resolved Hide resolved
IERC20 private immutable LINK_TOKEN;

uint256 private s_minWaitPeriodSeconds;
uint16 private s_maxPerform;
uint16 private s_maxCheck;
uint8 private s_upkeepInterval;
address[] private s_watchList;
mapping(address targetAddress => MonitoredAddress targetProperties) internal s_targets;
mapping(uint64 dstChainSelector => address onRamp) internal s_onRampAddresses;

/// @param linkTokenAddress the LINK token address
constructor(
address admin,
address linkTokenAddress,
uint256 minWaitPeriodSeconds,
uint16 maxPerform,
uint16 maxCheck,
uint8 upkeepInterval
) ConfirmedOwner(msg.sender) {
) {
if (linkTokenAddress == address(0)) revert InvalidLinkTokenAddress(linkTokenAddress);
_setRoleAdmin(ADMIN_ROLE, ADMIN_ROLE);
_setRoleAdmin(EXECUTOR_ROLE, ADMIN_ROLE);
_setupRole(ADMIN_ROLE, admin);
fbac marked this conversation as resolved.
Show resolved Hide resolved
LINK_TOKEN = IERC20(linkTokenAddress);
setMinWaitPeriodSeconds(minWaitPeriodSeconds);
setMaxPerform(maxPerform);
setMaxCheck(maxCheck);
setUpkeepInterval(upkeepInterval);
}

/// @notice Grants an address an executor role
/// @param executor address to grant executor role to
function granExecutorRole(address executor) public onlyRole(ADMIN_ROLE) {
fbac marked this conversation as resolved.
Show resolved Hide resolved
fbac marked this conversation as resolved.
Show resolved Hide resolved
if (executor == address(0)) revert InvalidAddress(executor);
_setupRole(EXECUTOR_ROLE, executor);
fbac marked this conversation as resolved.
Show resolved Hide resolved
}

/// @notice Revokes the executor role from an address
/// @param executor address to revoke executor role from
function revokeExecutorRole(address executor) public onlyRole(ADMIN_ROLE) {
if (executor == address(0)) revert InvalidAddress(executor);
_revokeRole(EXECUTOR_ROLE, executor);
}

fbac marked this conversation as resolved.
Show resolved Hide resolved
/// @notice Sets the list of subscriptions to watch and their funding parameters
/// @param addresses the list of target addresses to watch (could be direct target or IAggregatorProxy)
/// @param minBalances the list of corresponding minBalance for the target address
Expand All @@ -95,7 +118,7 @@ contract LinkAvailableBalanceMonitor is ConfirmedOwner, Pausable, AutomationComp
address[] calldata addresses,
uint96[] calldata minBalances,
uint96[] calldata topUpAmounts
) external onlyOwner {
) external onlyRoleOrAdminRole(EXECUTOR_ROLE) {
fbac marked this conversation as resolved.
Show resolved Hide resolved
if (addresses.length != minBalances.length || addresses.length != topUpAmounts.length) {
revert InvalidWatchList();
}
Expand All @@ -118,6 +141,50 @@ contract LinkAvailableBalanceMonitor is ConfirmedOwner, Pausable, AutomationComp
emit WatchlistUpdated();
}

/// @notice Adds a new address to the watchlist
/// @param targetAddress the address to be added to the watchlist
/// @param dstChainSelector carries a non-zero value in case the targetAddress is an onRamp, otherwise it carries a 0
/// @dev this function has to be compatible with the event onRampSet(address, dstChainSelector) emitted by
/// the CCIP router. Important detail to know is this event is also emitted when an onRamp is decomissioned,
/// in which case it will carry the proper dstChainSelector along with the 0x0 address
function addToWatchList(address targetAddress, uint64 dstChainSelector) public onlyRoleOrAdminRole(EXECUTOR_ROLE) {
if (s_targets[targetAddress].isActive) revert DuplicateAddress(targetAddress);
address oldAddress = s_onRampAddresses[dstChainSelector];
// if targetAddress is an existing onRamp, there's a need of cleaning the previous onRamp associated to this dstChainSelector
// there's no need to remove any other address that's not an onRamp
if (dstChainSelector > 0 && bytes(abi.encodePacked(oldAddress)).length > 0) {
fbac marked this conversation as resolved.
Show resolved Hide resolved
removeFromWatchList(oldAddress);
}
// only add the new address if it's not 0x0
if (targetAddress != address(0)) {
s_onRampAddresses[dstChainSelector] = targetAddress;
s_targets[targetAddress] = MonitoredAddress({
isActive: true,
minBalance: DEFAULT_MIN_BALANCE,
topUpAmount: DEFAULT_TOP_UP_AMOUNT,
lastTopUpTimestamp: 0
});
s_watchList.push(targetAddress);
} else {
// if the address is 0x0, it means the onRamp has ben decomissioned and has to be cleaned
delete s_onRampAddresses[dstChainSelector];
fbac marked this conversation as resolved.
Show resolved Hide resolved
}
}

/// @notice Delete an address from the watchlist and sets the target to inactive
/// @param targetAddress the address to be deleted
function removeFromWatchList(address targetAddress) public onlyRoleOrAdminRole(EXECUTOR_ROLE) returns (bool) {
s_targets[targetAddress].isActive = false;
for (uint i; i < s_watchList.length; i++) {
if (s_watchList[i] == targetAddress) {
s_watchList[i] = s_watchList[s_watchList.length - 1];
s_watchList.pop();
return true;
}
}
return false;
}

/// @notice Gets a list of proxies that are underfunded, up to the s_maxPerform size
/// @dev the function starts at a random index in the list to avoid biasing the first
/// addresses in the list over latter ones.
Expand Down Expand Up @@ -156,7 +223,7 @@ contract LinkAvailableBalanceMonitor is ConfirmedOwner, Pausable, AutomationComp
return targetsToFund;
}

function topUp(address[] memory targetAddresses) public whenNotPaused {
function topUp(address[] memory targetAddresses) public {
MonitoredAddress memory target;
uint256 localBalance = LINK_TOKEN.balanceOf(address(this));
for (uint256 idx = 0; idx < targetAddresses.length; idx++) {
Expand Down Expand Up @@ -201,7 +268,9 @@ contract LinkAvailableBalanceMonitor is ConfirmedOwner, Pausable, AutomationComp
}
try target.linkAvailableForPayment() returns (int256 balance) {
if (
balance < int256(minBalance) && addressToCheck.lastTopUpTimestamp + s_minWaitPeriodSeconds <= block.timestamp
balance < int256(minBalance) &&
addressToCheck.lastTopUpTimestamp + s_minWaitPeriodSeconds <= block.timestamp &&
addressToCheck.isActive
) {
return true;
}
Expand All @@ -212,9 +281,7 @@ contract LinkAvailableBalanceMonitor is ConfirmedOwner, Pausable, AutomationComp
/// @notice Gets list of subscription ids that are underfunded and returns a keeper-compatible payload.
/// @return upkeepNeeded signals if upkeep is needed
/// @return performData is an abi encoded list of subscription ids that need funds
function checkUpkeep(
bytes calldata
) external view override whenNotPaused returns (bool upkeepNeeded, bytes memory performData) {
function checkUpkeep(bytes calldata) external view override returns (bool upkeepNeeded, bytes memory performData) {
address[] memory needsFunding = sampleUnderfundedAddresses();
upkeepNeeded = needsFunding.length > 0;
performData = abi.encode(needsFunding);
Expand All @@ -231,14 +298,14 @@ contract LinkAvailableBalanceMonitor is ConfirmedOwner, Pausable, AutomationComp
/// @notice Withdraws the contract balance in the LINK token.
/// @param amount the amount of the LINK to withdraw
/// @param payee the address to pay
function withdraw(uint256 amount, address payable payee) external onlyOwner {
function withdraw(uint256 amount, address payable payee) external onlyRoleOrAdminRole(EXECUTOR_ROLE) {
if (payee == address(0)) revert InvalidAddress(payee);
LINK_TOKEN.transfer(payee, amount);
emit FundsWithdrawn(amount, payee);
}

/// @notice Sets the minimum balance for the given target address
function setMinBalance(address target, uint96 minBalance) external onlyOwner {
function setMinBalance(address target, uint96 minBalance) external onlyRoleOrAdminRole(EXECUTOR_ROLE) {
if (target == address(0)) revert InvalidAddress(target);
if (minBalance == 0) revert InvalidMinBalance(minBalance);
if (!s_targets[target].isActive) revert InvalidWatchList();
Expand All @@ -248,7 +315,7 @@ contract LinkAvailableBalanceMonitor is ConfirmedOwner, Pausable, AutomationComp
}

/// @notice Sets the minimum balance for the given target address
function setTopUpAmount(address target, uint96 topUpAmount) external onlyOwner {
function setTopUpAmount(address target, uint96 topUpAmount) external onlyRoleOrAdminRole(EXECUTOR_ROLE) {
if (target == address(0)) revert InvalidAddress(target);
if (topUpAmount == 0) revert InvalidTopUpAmount(topUpAmount);
if (!s_targets[target].isActive) revert InvalidWatchList();
Expand All @@ -258,25 +325,25 @@ contract LinkAvailableBalanceMonitor is ConfirmedOwner, Pausable, AutomationComp
}

/// @notice Update s_maxPerform
function setMaxPerform(uint16 maxPerform) public onlyOwner {
function setMaxPerform(uint16 maxPerform) public onlyRoleOrAdminRole(EXECUTOR_ROLE) {
s_maxPerform = maxPerform;
emit MaxPerformSet(s_maxPerform, maxPerform);
}

/// @notice Update s_maxCheck
function setMaxCheck(uint16 maxCheck) public onlyOwner {
function setMaxCheck(uint16 maxCheck) public onlyRoleOrAdminRole(EXECUTOR_ROLE) {
s_maxCheck = maxCheck;
emit MaxCheckSet(s_maxCheck, maxCheck);
}

/// @notice Sets the minimum wait period (in seconds) for addresses between funding
function setMinWaitPeriodSeconds(uint256 minWaitPeriodSeconds) public onlyOwner {
function setMinWaitPeriodSeconds(uint256 minWaitPeriodSeconds) public onlyRoleOrAdminRole(EXECUTOR_ROLE) {
s_minWaitPeriodSeconds = minWaitPeriodSeconds;
emit MinWaitPeriodSet(s_minWaitPeriodSeconds, minWaitPeriodSeconds);
}

/// @notice Update s_upkeepInterval
function setUpkeepInterval(uint8 upkeepInterval) public onlyOwner {
function setUpkeepInterval(uint8 upkeepInterval) public onlyRoleOrAdminRole(EXECUTOR_ROLE) {
if (upkeepInterval > 255) revert InvalidUpkeepInterval(upkeepInterval);
s_upkeepInterval = upkeepInterval;
emit UpkeepIntervalSet(s_upkeepInterval, upkeepInterval);
Expand Down Expand Up @@ -315,13 +382,13 @@ contract LinkAvailableBalanceMonitor is ConfirmedOwner, Pausable, AutomationComp
return (target.isActive, target.minBalance, target.topUpAmount);
}

/// @notice Pause the contract, which prevents executing performUpkeep
function pause() external onlyOwner {
_pause();
}

/// @notice Unpause the contract
function unpause() external onlyOwner {
_unpause();
/// @dev Modifier to make a function callable only by a certain role or the
/// admin role.
modifier onlyRoleOrAdminRole(bytes32 role) {
address sender = _msgSender();
if (!hasRole(ADMIN_ROLE, sender)) {
_checkRole(role, sender);
}
_;
}
}
Loading
Loading