Source Code
Overview
ETH Balance
0 ETH
Token Holdings
More Info
ContractCreator
Multi Chain
Multichain Addresses
0 address found via
Latest 25 from a total of 68 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
Value | ||||
---|---|---|---|---|---|---|---|---|---|
Add Funds | 9261354 | 159 days 12 hrs ago | IN | 0 ETH | 0.05018923 | ||||
Add Funds | 9260864 | 159 days 14 hrs ago | IN | 0 ETH | 0.0447214 | ||||
Add Funds | 9259404 | 159 days 21 hrs ago | IN | 0 ETH | 0 | ||||
Add Funds | 9255500 | 160 days 14 hrs ago | IN | 0 ETH | 0.0009112 | ||||
Add Funds | 9254781 | 160 days 16 hrs ago | IN | 0 ETH | 0.01748535 | ||||
Add Funds | 9254260 | 160 days 19 hrs ago | IN | 0 ETH | 0.00150632 | ||||
Add Funds | 9250798 | 161 days 10 hrs ago | IN | 0 ETH | 0.00000711 | ||||
Add Funds | 9250119 | 161 days 13 hrs ago | IN | 0 ETH | 0.00195768 | ||||
Add Funds | 9249630 | 161 days 15 hrs ago | IN | 0 ETH | 0.0041318 | ||||
Add Funds | 9249108 | 161 days 17 hrs ago | IN | 0 ETH | 0.0011132 | ||||
Add Funds | 9248618 | 161 days 19 hrs ago | IN | 0 ETH | 0.00191072 | ||||
Add Funds | 9246460 | 162 days 4 hrs ago | IN | 0 ETH | 0 | ||||
Add Funds | 9244467 | 162 days 12 hrs ago | IN | 0 ETH | 0.01451738 | ||||
Add Funds | 9244467 | 162 days 12 hrs ago | IN | 0 ETH | 0.01451738 | ||||
Add Funds | 9243946 | 162 days 15 hrs ago | IN | 0 ETH | 0.01347707 | ||||
Add Funds | 9243457 | 162 days 17 hrs ago | IN | 0 ETH | 0.00083412 | ||||
Add Funds | 9242950 | 162 days 19 hrs ago | IN | 0 ETH | 0.01092279 | ||||
Add Funds | 9242435 | 162 days 21 hrs ago | IN | 0 ETH | 0.01632066 | ||||
Add Funds | 9241401 | 163 days 1 hr ago | IN | 0 ETH | 0.00003962 | ||||
Add Funds | 9238032 | 163 days 16 hrs ago | IN | 0 ETH | 0.00002994 | ||||
Add Funds | 9236041 | 164 days 44 mins ago | IN | 0 ETH | 0.00000074 | ||||
Add Funds | 9227531 | 165 days 12 hrs ago | IN | 0 ETH | 0 | ||||
Add Funds | 9222556 | 166 days 10 hrs ago | IN | 0 ETH | 0.00001733 | ||||
Add Funds | 9215744 | 167 days 15 hrs ago | IN | 0 ETH | 0 | ||||
Add Funds | 9215744 | 167 days 15 hrs ago | IN | 0 ETH | 0 |
Latest 25 internal transactions (View All)
Advanced mode:
Parent Txn Hash | Block | From | To | Value | ||
---|---|---|---|---|---|---|
9261354 | 159 days 12 hrs ago | 0 ETH | ||||
9261354 | 159 days 12 hrs ago | 0 ETH | ||||
9261354 | 159 days 12 hrs ago | 0 ETH | ||||
9260864 | 159 days 14 hrs ago | 0 ETH | ||||
9260864 | 159 days 14 hrs ago | 0 ETH | ||||
9260864 | 159 days 14 hrs ago | 0 ETH | ||||
9259404 | 159 days 21 hrs ago | 0 ETH | ||||
9259404 | 159 days 21 hrs ago | 0 ETH | ||||
9259404 | 159 days 21 hrs ago | 0 ETH | ||||
9255500 | 160 days 14 hrs ago | 0 ETH | ||||
9255500 | 160 days 14 hrs ago | 0 ETH | ||||
9255500 | 160 days 14 hrs ago | 0 ETH | ||||
9254781 | 160 days 16 hrs ago | 0 ETH | ||||
9254781 | 160 days 16 hrs ago | 0 ETH | ||||
9254781 | 160 days 16 hrs ago | 0 ETH | ||||
9254260 | 160 days 19 hrs ago | 0 ETH | ||||
9254260 | 160 days 19 hrs ago | 0 ETH | ||||
9254260 | 160 days 19 hrs ago | 0 ETH | ||||
9250798 | 161 days 10 hrs ago | 0 ETH | ||||
9250798 | 161 days 10 hrs ago | 0 ETH | ||||
9250798 | 161 days 10 hrs ago | 0 ETH | ||||
9250119 | 161 days 13 hrs ago | 0 ETH | ||||
9250119 | 161 days 13 hrs ago | 0 ETH | ||||
9250119 | 161 days 13 hrs ago | 0 ETH | ||||
9249630 | 161 days 15 hrs ago | 0 ETH |
Loading...
Loading
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0x230396...032a6DA2 The constructor portion of the code might be different and could alter the actual behaviour of the contract
Contract Name:
UpkeepController
Compiler Version
v0.8.12+commit.f00d7308
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.8.12; import {LinkTokenInterface} from "@chainlink/contracts/src/v0.8/interfaces/LinkTokenInterface.sol"; import {UpkeepInfo, State, OnchainConfig, UpkeepFailureReason} from "@chainlink/contracts/src/v0.8/interfaces/AutomationRegistryInterface2_0.sol"; import {AutomationCompatibleInterface} from "@chainlink/contracts/src/v0.8/interfaces/AutomationCompatibleInterface.sol"; import {EnumerableSet} from "@openzeppelin/contractsV4/access/AccessControlEnumerable.sol"; import {AutomationCompatibleWithViewInterface} from "./interfaces/AutomationCompatibleWithViewInterface.sol"; import {AutomationRegistryWithMinANeededAmountInterface} from "./interfaces/AutomationRegistryWithMinANeededAmountInterface.sol"; import {KeeperRegistrarInterface} from "./interfaces/KeeperRegistrarInterface.sol"; import {UpkeepControllerInterface} from "./interfaces/UpkeepControllerInterface.sol"; /** * @title UpkeepController contract * @notice A contract that manages upkeeps for the Chainlink automation system. * @dev This contract implements the UpkeepControllerInterface and provides functionality to register, cancel, * pause, and unpause upkeeps, as well as update their check data, gas limits, and off-chain configurations. */ contract UpkeepController is UpkeepControllerInterface { using EnumerableSet for EnumerableSet.UintSet; LinkTokenInterface public immutable i_link; KeeperRegistrarInterface public immutable i_registrar; AutomationRegistryWithMinANeededAmountInterface public immutable i_registry; EnumerableSet.UintSet private activeUpkeeps; EnumerableSet.UintSet private pausedUpkeeps; /** * @notice Constructs the UpkeepController contract. * @param link The address of the LinkToken contract. * @param registrar The address of the KeeperRegistrar contract. * @param registry The address of the AutomationRegistry contract. */ constructor( LinkTokenInterface link, KeeperRegistrarInterface registrar, AutomationRegistryWithMinANeededAmountInterface registry ) { i_link = link; i_registrar = registrar; i_registry = registry; } /** * @dev See {UpkeepControllerInterface} */ function registerAndPredictID(KeeperRegistrarInterface.RegistrationParams memory params) public { i_link.transferFrom(msg.sender, address(this), params.amount); i_link.approve(address(i_registrar), params.amount); uint256 upkeepId = i_registrar.registerUpkeep(params); if (upkeepId != 0) { activeUpkeeps.add(upkeepId); emit UpkeepCreated(upkeepId); } else { revert("auto-approve disabled"); } } /** * @dev See {UpkeepControllerInterface} */ function cancelUpkeep(uint256 upkeepId) external { require(activeUpkeeps.contains(upkeepId), "Wrong upkeep id"); i_registry.cancelUpkeep(upkeepId); activeUpkeeps.remove(upkeepId); emit UpkeepCanceled(upkeepId); } /** * @dev See {UpkeepControllerInterface} */ function pauseUpkeep(uint256 upkeepId) external { require(activeUpkeeps.contains(upkeepId), "Wrong upkeep id"); i_registry.pauseUpkeep(upkeepId); pausedUpkeeps.add(upkeepId); activeUpkeeps.remove(upkeepId); emit UpkeepPaused(upkeepId); } /** * @dev See {UpkeepControllerInterface} */ function unpauseUpkeep(uint256 upkeepId) external { require(activeUpkeeps.contains(upkeepId), "Wrong upkeep id"); i_registry.unpauseUpkeep(upkeepId); pausedUpkeeps.remove(upkeepId); activeUpkeeps.add(upkeepId); emit UpkeepUnpaused(upkeepId); } /** * @dev See {UpkeepControllerInterface} */ function updateCheckData(uint256 upkeepId, bytes memory newCheckData) external { require(activeUpkeeps.contains(upkeepId), "Wrong upkeep id"); i_registry.updateCheckData(upkeepId, newCheckData); emit UpkeepUpdated(upkeepId, newCheckData); } /** * @dev See {UpkeepControllerInterface} */ function setUpkeepGasLimit(uint256 upkeepId, uint32 gasLimit) external { require(activeUpkeeps.contains(upkeepId), "Wrong upkeep id"); i_registry.setUpkeepGasLimit(upkeepId, gasLimit); emit UpkeepGasLimitSet(upkeepId, gasLimit); } /** * @dev See {UpkeepControllerInterface} */ function setUpkeepOffchainConfig(uint256 upkeepId, bytes calldata config) external { require(activeUpkeeps.contains(upkeepId), "Wrong upkeep id"); i_registry.setUpkeepOffchainConfig(upkeepId, config); emit UpkeepOffchainConfigSet(upkeepId, config); } /** * @dev See {UpkeepControllerInterface} */ function addFunds(uint256 upkeepId, uint96 amount) external { require(activeUpkeeps.contains(upkeepId), "Wrong upkeep id"); i_link.transferFrom(msg.sender, address(this), amount); i_link.approve(address(i_registry), amount); i_registry.addFunds(upkeepId, amount); emit FundsAdded(upkeepId, amount); } /** * @dev See {UpkeepControllerInterface} */ function getUpkeep(uint256 upkeepId) external view returns (UpkeepInfo memory upkeepInfo) { return i_registry.getUpkeep(upkeepId); } /** * @dev See {UpkeepControllerInterface} */ function getActiveUpkeepIDs(uint256 offset, uint256 limit) public view returns (uint256[] memory upkeeps) { uint256 ordersCount = activeUpkeeps.length(); if (offset >= ordersCount) return new uint256[](0); uint256 to = offset + limit; if (ordersCount < to) to = ordersCount; upkeeps = new uint256[](to - offset); for (uint256 i = 0; i < upkeeps.length; i++) upkeeps[i] = activeUpkeeps.at(offset + i); } /** * @dev See {UpkeepControllerInterface} */ function getUpkeeps(uint256 offset, uint256 limit) public view returns (UpkeepInfo[] memory) { uint256[] memory activeIds = getActiveUpkeepIDs(offset, limit); // FIX IT UpkeepInfo[] memory upkeepsInfo = new UpkeepInfo[](activeIds.length); for (uint256 i = 0; i < upkeepsInfo.length; i++) { upkeepsInfo[i] = i_registry.getUpkeep(activeIds[i]); } return upkeepsInfo; } /** * @dev See {UpkeepControllerInterface} */ function getMinBalanceForUpkeep(uint256 upkeepId) external view returns (uint96) { return i_registry.getMinBalanceForUpkeep(upkeepId); } /** * @dev See {UpkeepControllerInterface} */ function getMinBalancesForUpkeeps(uint256 offset, uint256 limit) public view returns (uint96[] memory) { uint256[] memory activeIds = getActiveUpkeepIDs(offset, limit); uint256 count = activeIds.length; if (offset >= count) return new uint96[](0); uint256 to = offset + limit; if (count < to) to = count; uint96[] memory upkeepsMinAmounts = new uint96[](to - offset); for (uint256 i = 0; i < upkeepsMinAmounts.length; i++) { upkeepsMinAmounts[i] = i_registry.getMinBalanceForUpkeep(activeIds[i]); } return upkeepsMinAmounts; } /** * @dev See {UpkeepControllerInterface} */ function getDetailedUpkeeps(uint256 offset, uint256 limit) external view returns (DetailedUpkeep[] memory) { uint256[] memory activeIds = getActiveUpkeepIDs(offset, limit); uint256 count = activeIds.length; if (offset >= count) return new DetailedUpkeep[](0); uint256 to = offset + limit; if (count < to) to = count; DetailedUpkeep[] memory detailedUpkeeps = new DetailedUpkeep[](to - offset); UpkeepInfo[] memory info = getUpkeeps(offset, limit); uint96[] memory minAmounts = getMinBalancesForUpkeeps(offset, limit); for (uint256 i = 0; i < detailedUpkeeps.length; i++) { detailedUpkeeps[i] = DetailedUpkeep(activeIds[i], minAmounts[i], info[i]); } return detailedUpkeeps; } /** * @dev See {UpkeepControllerInterface} */ function getUpkeepsCount() external view returns (uint256) { return activeUpkeeps.length(); } /** * @dev See {UpkeepControllerInterface} */ function getState() external view returns ( State memory state, OnchainConfig memory config, address[] memory signers, address[] memory transmitters, uint8 f ) { return i_registry.getState(); } /** * @dev See {UpkeepControllerInterface} */ function isNewUpkeepNeeded() external view returns (bool isNeeded, uint256 newOffset, uint256 newLimit) { uint256 lastActive = activeUpkeeps.length() - 1; uint256 lastUpkeepId = activeUpkeeps.at(lastActive); UpkeepInfo memory info = i_registry.getUpkeep(lastUpkeepId); (uint128 performOffset, uint128 performLimit) = abi.decode(info.checkData, (uint128, uint128)); (, bytes memory checkResult) = AutomationCompatibleWithViewInterface(info.target).checkUpkeep(info.checkData); uint256[] memory performArray = abi.decode(checkResult, (uint256[])); isNeeded = performArray.length >= performLimit ? true : false; newOffset = performOffset + performLimit; newLimit = performLimit; } /** * @dev See {UpkeepControllerInterface} */ function checkUpkeep( uint256 upkeepId ) public returns ( bool upkeepNeeded, bytes memory performData, UpkeepFailureReason upkeepFailureReason, uint256 gasUsed, uint256 fastGasWei, uint256 linkNative ) { return i_registry.checkUpkeep(upkeepId); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface AutomationCompatibleInterface { /** * @notice method that is simulated by the keepers to see if any work actually * needs to be performed. This method does does not actually need to be * executable, and since it is only ever simulated it can consume lots of gas. * @dev To ensure that it is never called, you may want to add the * cannotExecute modifier from KeeperBase to your implementation of this * method. * @param checkData specified in the upkeep registration so it is always the * same for a registered upkeep. This can easily be broken down into specific * arguments using `abi.decode`, so multiple upkeeps can be registered on the * same contract and easily differentiated by the contract. * @return upkeepNeeded boolean to indicate whether the keeper should call * performUpkeep or not. * @return performData bytes that the keeper should call performUpkeep with, if * upkeep is needed. If you would like to encode data to decode later, try * `abi.encode`. */ function checkUpkeep(bytes calldata checkData) external returns (bool upkeepNeeded, bytes memory performData); /** * @notice method that is actually executed by the keepers, via the registry. * The data returned by the checkUpkeep simulation will be passed into * this method to actually be executed. * @dev The input to this method should not be trusted, and the caller of the * method should not even be restricted to any single registry. Anyone should * be able call it, and the input should be validated, there is no guarantee * that the data passed in is the performData returned from checkUpkeep. This * could happen due to malicious keepers, racing keepers, or simply a state * change while the performUpkeep transaction is waiting for confirmation. * Always validate the data passed in. * @param performData is the data which was passed back from the checkData * simulation. If it is encoded, it can easily be decoded into other types by * calling `abi.decode`. This data should not be trusted, and should be * validated against the contract's current state. */ function performUpkeep(bytes calldata performData) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @notice OnchainConfig of the registry * @dev only used in params and return values * @member paymentPremiumPPB payment premium rate oracles receive on top of * being reimbursed for gas, measured in parts per billion * @member flatFeeMicroLink flat fee paid to oracles for performing upkeeps, * priced in MicroLink; can be used in conjunction with or independently of * paymentPremiumPPB * @member checkGasLimit gas limit when checking for upkeep * @member stalenessSeconds number of seconds that is allowed for feed data to * be stale before switching to the fallback pricing * @member gasCeilingMultiplier multiplier to apply to the fast gas feed price * when calculating the payment ceiling for keepers * @member minUpkeepSpend minimum LINK that an upkeep must spend before cancelling * @member maxPerformGas max executeGas allowed for an upkeep on this registry * @member fallbackGasPrice gas price used if the gas price feed is stale * @member fallbackLinkPrice LINK price used if the LINK price feed is stale * @member transcoder address of the transcoder contract * @member registrar address of the registrar contract */ struct OnchainConfig { uint32 paymentPremiumPPB; uint32 flatFeeMicroLink; // min 0.000001 LINK, max 4294 LINK uint32 checkGasLimit; uint24 stalenessSeconds; uint16 gasCeilingMultiplier; uint96 minUpkeepSpend; uint32 maxPerformGas; uint32 maxCheckDataSize; uint32 maxPerformDataSize; uint256 fallbackGasPrice; uint256 fallbackLinkPrice; address transcoder; address registrar; } /** * @notice state of the registry * @dev only used in params and return values * @member nonce used for ID generation * @member ownerLinkBalance withdrawable balance of LINK by contract owner * @member expectedLinkBalance the expected balance of LINK of the registry * @member totalPremium the total premium collected on registry so far * @member numUpkeeps total number of upkeeps on the registry * @member configCount ordinal number of current config, out of all configs applied to this contract so far * @member latestConfigBlockNumber last block at which this config was set * @member latestConfigDigest domain-separation tag for current config * @member latestEpoch for which a report was transmitted * @member paused freeze on execution scoped to the entire registry */ struct State { uint32 nonce; uint96 ownerLinkBalance; uint256 expectedLinkBalance; uint96 totalPremium; uint256 numUpkeeps; uint32 configCount; uint32 latestConfigBlockNumber; bytes32 latestConfigDigest; uint32 latestEpoch; bool paused; } /** * @notice all information about an upkeep * @dev only used in return values * @member target the contract which needs to be serviced * @member executeGas the gas limit of upkeep execution * @member checkData the checkData bytes for this upkeep * @member balance the balance of this upkeep * @member admin for this upkeep * @member maxValidBlocknumber until which block this upkeep is valid * @member lastPerformBlockNumber the last block number when this upkeep was performed * @member amountSpent the amount this upkeep has spent * @member paused if this upkeep has been paused * @member skipSigVerification skip signature verification in transmit for a low security low cost model */ struct UpkeepInfo { address target; uint32 executeGas; bytes checkData; uint96 balance; address admin; uint64 maxValidBlocknumber; uint32 lastPerformBlockNumber; uint96 amountSpent; bool paused; bytes offchainConfig; } enum UpkeepFailureReason { NONE, UPKEEP_CANCELLED, UPKEEP_PAUSED, TARGET_CHECK_REVERTED, UPKEEP_NOT_NEEDED, PERFORM_DATA_EXCEEDS_LIMIT, INSUFFICIENT_BALANCE } interface AutomationRegistryBaseInterface { function registerUpkeep( address target, uint32 gasLimit, address admin, bytes calldata checkData, bytes calldata offchainConfig ) external returns (uint256 id); function cancelUpkeep(uint256 id) external; function pauseUpkeep(uint256 id) external; function unpauseUpkeep(uint256 id) external; function transferUpkeepAdmin(uint256 id, address proposed) external; function acceptUpkeepAdmin(uint256 id) external; function updateCheckData(uint256 id, bytes calldata newCheckData) external; function addFunds(uint256 id, uint96 amount) external; function setUpkeepGasLimit(uint256 id, uint32 gasLimit) external; function setUpkeepOffchainConfig(uint256 id, bytes calldata config) external; function getUpkeep(uint256 id) external view returns (UpkeepInfo memory upkeepInfo); function getActiveUpkeepIDs(uint256 startIndex, uint256 maxCount) external view returns (uint256[] memory); function getTransmitterInfo(address query) external view returns ( bool active, uint8 index, uint96 balance, uint96 lastCollected, address payee ); function getState() external view returns ( State memory state, OnchainConfig memory config, address[] memory signers, address[] memory transmitters, uint8 f ); } /** * @dev The view methods are not actually marked as view in the implementation * but we want them to be easily queried off-chain. Solidity will not compile * if we actually inherit from this interface, so we document it here. */ interface AutomationRegistryInterface is AutomationRegistryBaseInterface { function checkUpkeep(uint256 upkeepId) external view returns ( bool upkeepNeeded, bytes memory performData, UpkeepFailureReason upkeepFailureReason, uint256 gasUsed, uint256 fastGasWei, uint256 linkNative ); } interface AutomationRegistryExecutableInterface is AutomationRegistryBaseInterface { function checkUpkeep(uint256 upkeepId) external returns ( bool upkeepNeeded, bytes memory performData, UpkeepFailureReason upkeepFailureReason, uint256 gasUsed, uint256 fastGasWei, uint256 linkNative ); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface LinkTokenInterface { function allowance(address owner, address spender) external view returns (uint256 remaining); function approve(address spender, uint256 value) external returns (bool success); function balanceOf(address owner) external view returns (uint256 balance); function decimals() external view returns (uint8 decimalPlaces); function decreaseApproval(address spender, uint256 addedValue) external returns (bool success); function increaseApproval(address spender, uint256 subtractedValue) external; function name() external view returns (string memory tokenName); function symbol() external view returns (string memory tokenSymbol); function totalSupply() external view returns (uint256 totalTokensIssued); function transfer(address to, uint256 value) external returns (bool success); function transferAndCall( address to, uint256 value, bytes calldata data ) external returns (bool success); function transferFrom( address from, address to, uint256 value ) external returns (bool success); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol) pragma solidity ^0.8.0; import "./IAccessControl.sol"; import "../utils/Context.sol"; import "../utils/Strings.sol"; import "../utils/introspection/ERC165.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ```solidity * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ```solidity * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules} * to enforce additional security measures for this role. */ abstract contract AccessControl is Context, IAccessControl, ERC165 { struct RoleData { mapping(address => bool) members; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view virtual override returns (bool) { return _roles[role].members[account]; } /** * @dev Revert with a standard message if `_msgSender()` is missing `role`. * Overriding this function changes the behavior of the {onlyRole} modifier. * * Format of the revert message is described in {_checkRole}. * * _Available since v4.6._ */ function _checkRole(bytes32 role) internal view virtual { _checkRole(role, _msgSender()); } /** * @dev Revert with a standard message if `account` is missing `role`. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", Strings.toHexString(account), " is missing role ", Strings.toHexString(uint256(role), 32) ) ) ); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleGranted} event. */ function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleRevoked} event. */ function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. * * May emit a {RoleRevoked} event. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * May emit a {RoleGranted} event. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== * * NOTE: This function is deprecated in favor of {_grantRole}. */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Grants `role` to `account`. * * Internal function without access restriction. * * May emit a {RoleGranted} event. */ function _grantRole(bytes32 role, address account) internal virtual { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } /** * @dev Revokes `role` from `account`. * * Internal function without access restriction. * * May emit a {RoleRevoked} event. */ function _revokeRole(bytes32 role, address account) internal virtual { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControlEnumerable.sol) pragma solidity ^0.8.0; import "./IAccessControlEnumerable.sol"; import "./AccessControl.sol"; import "../utils/structs/EnumerableSet.sol"; /** * @dev Extension of {AccessControl} that allows enumerating the members of each role. */ abstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl { using EnumerableSet for EnumerableSet.AddressSet; mapping(bytes32 => EnumerableSet.AddressSet) private _roleMembers; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) public view virtual override returns (address) { return _roleMembers[role].at(index); } /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) public view virtual override returns (uint256) { return _roleMembers[role].length(); } /** * @dev Overload {_grantRole} to track enumerable memberships */ function _grantRole(bytes32 role, address account) internal virtual override { super._grantRole(role, account); _roleMembers[role].add(account); } /** * @dev Overload {_revokeRole} to track enumerable memberships */ function _revokeRole(bytes32 role, address account) internal virtual override { super._revokeRole(role, account); _roleMembers[role].remove(account); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol) pragma solidity ^0.8.0; import "./IAccessControl.sol"; /** * @dev External interface of AccessControlEnumerable declared to support ERC165 detection. */ interface IAccessControlEnumerable is IAccessControl { /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) external view returns (address); /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) external view returns (uint256); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { // Solidity will revert if denominator == 0, unlike the div opcode on its own. // The surrounding unchecked block does not change this fact. // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic. return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1, "Math: mulDiv overflow"); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10 ** 64) { value /= 10 ** 64; result += 64; } if (value >= 10 ** 32) { value /= 10 ** 32; result += 32; } if (value >= 10 ** 16) { value /= 10 ** 16; result += 16; } if (value >= 10 ** 8) { value /= 10 ** 8; result += 8; } if (value >= 10 ** 4) { value /= 10 ** 4; result += 4; } if (value >= 10 ** 2) { value /= 10 ** 2; result += 2; } if (value >= 10 ** 1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 256, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol) pragma solidity ^0.8.0; /** * @dev Standard signed math utilities missing in the Solidity language. */ library SignedMath { /** * @dev Returns the largest of two signed numbers. */ function max(int256 a, int256 b) internal pure returns (int256) { return a > b ? a : b; } /** * @dev Returns the smallest of two signed numbers. */ function min(int256 a, int256 b) internal pure returns (int256) { return a < b ? a : b; } /** * @dev Returns the average of two signed numbers without overflow. * The result is rounded towards zero. */ function average(int256 a, int256 b) internal pure returns (int256) { // Formula from the book "Hacker's Delight" int256 x = (a & b) + ((a ^ b) >> 1); return x + (int256(uint256(x) >> 255) & (a ^ b)); } /** * @dev Returns the absolute unsigned value of a signed value. */ function abs(int256 n) internal pure returns (uint256) { unchecked { // must be unchecked in order to support `n = type(int256).min` return uint256(n >= 0 ? n : -n); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/Math.sol"; import "./math/SignedMath.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant _SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `int256` to its ASCII `string` decimal representation. */ function toString(int256 value) internal pure returns (string memory) { return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMath.abs(value)))); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } /** * @dev Returns true if the two strings are equal. */ function equal(string memory a, string memory b) internal pure returns (bool) { return keccak256(bytes(a)) == keccak256(bytes(b)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/structs/EnumerableSet.sol) // This file was procedurally generated from scripts/generate/templates/EnumerableSet.js. pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ```solidity * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. * * [WARNING] * ==== * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure * unusable. * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info. * * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an * array of EnumerableSet. * ==== */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping(bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; if (lastIndex != toDeleteIndex) { bytes32 lastValue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastValue; // Update the index for the moved value set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex } // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { bytes32[] memory store = _values(set._inner); bytes32[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values in the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.12; import {KeeperRegistrarInterface} from "./KeeperRegistrarInterface.sol"; interface AutomationCompatibleWithViewInterface { /** * @notice Checks the upkeep status and provides the necessary data for performing the upkeep. * @param checkData Additional data needed to determine the upkeep status. * @return upkeepNeeded Indicates whether the upkeep is needed or not. * @return performData The data required to perform the upkeep. * @dev This function allows users to check the status of an upkeep and obtain the data necessary to perform the upkeep. * The checkData parameter contains any additional data required to determine the upkeep status. * The function returns a boolean value (upkeepNeeded) indicating whether the upkeep is needed or not. * If upkeepNeeded is true, it means the upkeep should be performed. * In addition, the function returns performData, which is the data needed to execute the upkeep. * Users can use this data to perform the upkeep. */ function checkUpkeep(bytes calldata checkData) external view returns (bool upkeepNeeded, bytes memory performData); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.12; import {AutomationRegistryExecutableInterface} from "@chainlink/contracts/src/v0.8/interfaces/AutomationRegistryInterface2_0.sol"; interface AutomationRegistryWithMinANeededAmountInterface is AutomationRegistryExecutableInterface { /** * @notice Retrieves the minimum balance required for a specific upkeep. * @param upkeepId The unique identifier (ID) of the upkeep. * @return The minimum balance required for the specified upkeep. * @dev This function allows users to retrieve the minimum balance required to perform a specific upkeep. * The minimum balance represents the amount of funds that need to be available in the contract in order to execute the upkeep successfully. * The upkeep ID is used to identify the specific upkeep for which the minimum balance is being retrieved. */ function getMinBalanceForUpkeep(uint256 upkeepId) external view returns (uint96); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.12; interface KeeperRegistrarInterface { /** * @notice Represents the registration parameters required for creating an upkeep. * @param name The name associated with the upkeep. * @param encryptedEmail The encrypted email associated with the upkeep. * @param upkeepContract The address of the upkeep contract. * @param gasLimit The gas limit for the upkeep. * @param adminAddress The address of the admin associated with the upkeep. * @param checkData Additional data used for checking the upkeep. * @param offchainConfig Off-chain configuration data associated with the upkeep. * @param amount The amount associated with the upkeep. * @dev This struct encapsulates the upkeep parameters required for creating an upkeep. */ struct RegistrationParams { string name; bytes encryptedEmail; address upkeepContract; uint32 gasLimit; address adminAddress; bytes checkData; bytes offchainConfig; uint96 amount; } /** * @notice Registers an upkeep using the provided registration parameters. * @param requestParams The registration parameters for creating the upkeep. * @return The unique identifier (ID) assigned to the newly registered upkeep. * @dev This function allows users to register an upkeep by providing the necessary registration parameters. * The registration parameters include information such as the name, encrypted email, upkeep contract address, * gas limit, admin address, additional check data, off-chain configuration, and amount. * Upon successful registration, a unique identifier (ID) is assigned to the upkeep, which can be used for future reference. * @dev Emits an {UpkeepCreated} event. */ function registerUpkeep(RegistrationParams calldata requestParams) external returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.12; import {UpkeepInfo, State, OnchainConfig, UpkeepFailureReason} from "@chainlink/contracts/src/v0.8/interfaces/AutomationRegistryInterface2_0.sol"; import {AutomationRegistryExecutableInterface} from "@chainlink/contracts/src/v0.8/interfaces/AutomationRegistryInterface2_0.sol"; import {KeeperRegistrarInterface} from "./KeeperRegistrarInterface.sol"; interface UpkeepControllerInterface { /** * @notice Represents a detailed upkeep containing information about an upkeep, * including its ID, minimum amount, and additional upkeep information. * @param id The ID of the upkeep. * @param minAmount The minimum amount required for the upkeep. * @param info The UpkeepInfo struct containing detailed information about the upkeep. * @dev This struct is used to encapsulate detailed information about an upkeep, * including its relevant details. */ struct DetailedUpkeep { uint256 id; uint96 minAmount; UpkeepInfo info; } /** * @notice Emitted when a new upkeep is created. * @param id The ID of the created upkeep. * @dev This event is emitted when a new upkeep. */ event UpkeepCreated(uint256 indexed id); /** * @notice Emitted when an upkeep is canceled. * @param id The ID of the canceled upkeep. * @dev This event is emitted when an upkeep is canceled. */ event UpkeepCanceled(uint256 indexed id); /** * @notice Emitted when an upkeep is paused. * @param id The ID of the paused upkeep. * @dev This event is emitted when an upkeep is paused. */ event UpkeepPaused(uint256 indexed id); /** * @notice Emitted when an upkeep is unpaused. * @param id The ID of the unpaused upkeep. * @dev This event is emitted when an upkeep is unpaused. */ event UpkeepUnpaused(uint256 indexed id); /** * @notice Emitted when an upkeep is updated. * @param id The ID of the updated upkeep. * @param newCheckData The new check data for the upkeep. * @dev This event is emitted when an upkeep is updated, with the new check data included. */ event UpkeepUpdated(uint256 indexed id, bytes newCheckData); /** * @notice Emitted when funds are added to an upkeep. * @param id The ID of the upkeep to which funds are added. * @param amount The amount of funds added to the upkeep. * @dev This event is emitted when funds are added to an upkeep. */ event FundsAdded(uint256 indexed id, uint96 amount); /** * @notice Emitted when the gas limit is set for an upkeep. * @param id The ID of the upkeep for which the gas limit is set. * @param amount The gas limit value set for the upkeep. * @dev This event is emitted when the gas limit is set for an upkeep. */ event UpkeepGasLimitSet(uint256 indexed id, uint32 amount); /** * @notice Emitted when the off-chain configuration is set for an upkeep. * @param id The ID of the upkeep for which the off-chain configuration is set. * @param config The off-chain configuration data set for the upkeep. * @dev This event is emitted when the off-chain configuration is set for an upkeep. */ event UpkeepOffchainConfigSet(uint256 indexed id, bytes config); /** * @notice Registers a new upkeep and predicts its ID. * @param params The registration parameters for the upkeep. * @dev The caller must approve the transfer of LINK tokens to this contract before calling this function. * @dev This function transfers the specified amount of LINK tokens from the caller to this contract. * @dev It then approves the transfer of LINK tokens to the KeeperRegistrar contract. * @dev Next, it calls the registerUpkeep function of the KeeperRegistrar contract to register the upkeep. * @dev If the upkeep is successfully registered, the upkeep ID is added to the activeUpkeeps set and an UpkeepCreated event is emitted. * @dev If the upkeep registration fails, the function reverts with an error message. * @dev Emits a {UpkeepCreated} event. */ function registerAndPredictID(KeeperRegistrarInterface.RegistrationParams memory params) external; /** * @notice Cancel an active upkeep. * @param upkeepId The ID of the upkeep to cancel. * @dev The upkeep must be active. * @dev This function calls the cancelUpkeep function of the AutomationRegistry contract to cancel the upkeep. * @dev It removes the upkeep ID from the activeUpkeeps set. * @dev Emits a {UpkeepCanceled} event. */ function cancelUpkeep(uint256 upkeepId) external; /** * @notice Pauses an active upkeep. * @param upkeepId The ID of the upkeep to pause. * @dev The upkeep must be active. * @dev This function calls the pauseUpkeep function of the AutomationRegistry contract to pause the upkeep. * @dev It removes the upkeep ID from the activeUpkeeps set, adds it to the pausedUpkeeps set. * @dev Emits a {UpkeepPaused} event. */ function pauseUpkeep(uint256 upkeepId) external; /** * @notice Unpauses a paused upkeep. * @param upkeepId The ID of the upkeep to unpause. * @dev The upkeep must be paused. * @dev This function calls the unpauseUpkeep function of the AutomationRegistry contract to unpause the upkeep. * @dev It removes the upkeep ID from the pausedUpkeeps set, adds it to the activeUpkeeps set. * @dev Emits a {UpkeepUnpaused} event. */ function unpauseUpkeep(uint256 upkeepId) external; /** * @notice Updates the check data of an upkeep. * @param upkeepId The ID of the upkeep to update. * @param newCheckData The new check data to set for the upkeep. * @dev The upkeep must be an active upkeep. * @dev This function calls the updateCheckData function of the AutomationRegistryWithMinANeededAmount contract to update the check data of the upkeep. * @dev Emits a {UpkeepUpdated} event. */ function updateCheckData(uint256 upkeepId, bytes memory newCheckData) external; /** * @notice Update the gas limit for an specific upkeep. * @param upkeepId The ID of the upkeep to set the gas limit for. * @param gasLimit The gas limit to set for the upkeep. * @dev The upkeep must be active. * @dev This function calls the setUpkeepGasLimit function of the AutomationRegistry * contract to set the gas limit for the upkeep. * @dev Emits a {UpkeepGasLimitSet} event. */ function setUpkeepGasLimit(uint256 upkeepId, uint32 gasLimit) external; /** * @notice Update the off-chain configuration for an upkeep. * @param upkeepId The ID of the upkeep to set the off-chain configuration for. * @param config The off-chain configuration data to set for the upkeep. * @dev The upkeep must be active. * @dev This function calls the setUpkeepOffchainConfig function of the AutomationRegistry contract * to set the off-chain configuration for the upkeep. * @dev Emits a {UpkeepOffchainConfigSet} event. */ function setUpkeepOffchainConfig(uint256 upkeepId, bytes calldata config) external; /** * @notice Adds funds to an upkeep. * @param upkeepId The ID of the upkeep to add funds to. * @param amount The amount of funds to add to the upkeep. * @dev The upkeep must be active. * @dev This function transfers the specified amount of LINK tokens from the caller to the contract. * @dev It approves the transferred LINK tokens for the AutomationRegistry contract * and calls the addFunds function of the AutomationRegistry contract to add funds to the upkeep. * @dev Emits a {FundsAdded} event. */ function addFunds(uint256 upkeepId, uint96 amount) external; /** * @notice Retrieves the information of an upkeep. * @param upkeepId The ID of the upkeep to retrieve information for. * @return upkeepInfo The UpkeepInfo struct containing the information of the upkeep. * @dev This function calls the getUpkeep function of the AutomationRegistry contract to retrieve the information of the upkeep. */ function getUpkeep(uint256 upkeepId) external view returns (UpkeepInfo memory upkeepInfo); /** * @notice Retrieves the IDs of active upkeeps within a specified range. * @param offset The starting index of the range. * @param limit The maximum number of IDs to retrieve. * @return upkeeps An array of active upkeep IDs within the specified range. * @dev This function returns an array of active upkeep IDs, starting from the offset and up to the specified limit. * @dev If the offset exceeds the total number of active upkeeps, an empty array is returned. * @dev This function uses the activeUpkeeps set to retrieve the IDs. */ function getActiveUpkeepIDs(uint256 offset, uint256 limit) external view returns (uint256[] memory upkeeps); /** * @notice Retrieves a batch of upkeeps with their information. * @param offset The starting index of the range. * @param limit The maximum number of upkeeps to retrieve. * @return upkeeps An array of UpkeepInfo structs containing the information of the retrieved upkeeps. * @dev This function retrieves a batch of upkeeps by calling the getActiveUpkeepIDs function * to get the IDs of active upkeeps within the specified range. * @dev It then iterates over the retrieved IDs and calls the getUpkeep function of the AutomationRegistry contract * to retrieve the information of each upkeep. */ function getUpkeeps(uint256 offset, uint256 limit) external view returns (UpkeepInfo[] memory); /** * @notice Retrieves the minimum balance required for an upkeep. * @param upkeepId The ID of the upkeep to retrieve the minimum balance for. * @return minBalance The minimum balance required for the upkeep. * @dev This function calls the getMinBalanceForUpkeep function of the AutomationRegistry contract * to retrieve the minimum balance required for the upkeep. */ function getMinBalanceForUpkeep(uint256 upkeepId) external view returns (uint96); /** * @notice Retrieves the minimum balances required for a batch of upkeeps. * @param offset The starting index of the range. * @param limit The maximum number of upkeeps to retrieve minimum balances for. * @return minBalances An array of minimum balances required for the retrieved upkeeps. * @dev This function retrieves a batch of upkeeps by calling the getActiveUpkeepIDs function * to get the IDs of active upkeeps within the specified range. * @dev It then iterates over the retrieved IDs and calls the getMinBalanceForUpkeep function of the AutomationRegistry contract * to retrieve the minimum balance for each upkeep. */ function getMinBalancesForUpkeeps(uint256 offset, uint256 limit) external view returns (uint96[] memory); /** * @notice Retrieves a batch of detailed upkeeps. * @param offset The starting index of the range. * @param limit The maximum number of detailed upkeeps to retrieve. * @return detailedUpkeeps An array of DetailedUpkeep structs containing the information of the retrieved detailed upkeeps. * @dev This function retrieves a batch of upkeeps by calling the getActiveUpkeepIDs function * to get the IDs of active upkeeps within the specified range. * @dev It then calls the getUpkeeps and getMinBalancesForUpkeeps functions to retrieve the information and minimum balances for the upkeeps. * @dev Finally, it combines the information into DetailedUpkeep structs and returns an array of detailed upkeeps. */ function getDetailedUpkeeps(uint256 offset, uint256 limit) external view returns (DetailedUpkeep[] memory); /** * @notice Retrieves the total number of active upkeeps. * @return count The total number of active upkeeps. * @dev This function returns the length of the activeUpkeeps set, representing the total number of active upkeeps. */ function getUpkeepsCount() external view returns (uint256); /** * @notice Retrieves the current state, configuration, signers, transmitters, and flag from the registry. * @return state The State struct containing the current state of the registry. * @return config The OnchainConfig struct containing the current on-chain configuration of the registry. * @return signers An array of addresses representing the signers associated with the registry. * @return transmitters An array of addresses representing the transmitters associated with the registry. * @return f The flag value associated with the registry. * @dev This function calls the getState function of the AutomationRegistry contract * to retrieve the current state, configuration, signers, transmitters, and flag. */ function getState() external view returns ( State memory state, OnchainConfig memory config, address[] memory signers, address[] memory transmitters, uint8 f ); /** * @notice Checks if a new upkeep is needed and returns the offset and limit for the next of upkeep. * @return isNeeded A boolean indicating whether a new upkeep is needed. * @return newOffset The offset value for the next upkeep. * @return newLimit The limit value for the next upkeep. * @dev This function calculates the offset and limit for the next upkeep based on the last active upkeep. * @dev It retrieves the last active upkeep ID and the associated performOffset and performLimit from the registry. * @dev It then calls the checkUpkeep function of the AutomationCompatible contract to perform the upkeep check. * @dev The result is used to determine whether a new upkeep is needed, * and the new offset and limit values for the next upkeep are calculated. */ function isNewUpkeepNeeded() external view returns (bool isNeeded, uint256 newOffset, uint256 newLimit); /** * @notice Performs the upkeep check for a specific upkeep. * @param upkeepId The ID of the upkeep to check. * @return upkeepNeeded A boolean indicating whether the upkeep is needed. * @return performData The perform data associated with the upkeep. * @return upkeepFailureReason The reason for the upkeep failure, if applicable. * @return gasUsed The amount of gas used during the upkeep check. * @return fastGasWei The wei value for fast gas during the upkeep check. * @return linkNative The amount of LINK or native currency used during the upkeep check. * @dev This function calls the checkUpkeep function of the AutomationRegistry contract * to perform the upkeep check for the specified upkeep. */ function checkUpkeep( uint256 upkeepId ) external returns ( bool upkeepNeeded, bytes memory performData, UpkeepFailureReason upkeepFailureReason, uint256 gasUsed, uint256 fastGasWei, uint256 linkNative ); }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "metadata": { "useLiteralContent": true }, "libraries": {} }
[{"inputs":[{"internalType":"contract LinkTokenInterface","name":"link","type":"address"},{"internalType":"contract KeeperRegistrarInterface","name":"registrar","type":"address"},{"internalType":"contract AutomationRegistryWithMinANeededAmountInterface","name":"registry","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint96","name":"amount","type":"uint96"}],"name":"FundsAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"UpkeepCanceled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"UpkeepCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint32","name":"amount","type":"uint32"}],"name":"UpkeepGasLimitSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"config","type":"bytes"}],"name":"UpkeepOffchainConfigSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"UpkeepPaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"UpkeepUnpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"newCheckData","type":"bytes"}],"name":"UpkeepUpdated","type":"event"},{"inputs":[{"internalType":"uint256","name":"upkeepId","type":"uint256"},{"internalType":"uint96","name":"amount","type":"uint96"}],"name":"addFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"upkeepId","type":"uint256"}],"name":"cancelUpkeep","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"upkeepId","type":"uint256"}],"name":"checkUpkeep","outputs":[{"internalType":"bool","name":"upkeepNeeded","type":"bool"},{"internalType":"bytes","name":"performData","type":"bytes"},{"internalType":"enum UpkeepFailureReason","name":"upkeepFailureReason","type":"uint8"},{"internalType":"uint256","name":"gasUsed","type":"uint256"},{"internalType":"uint256","name":"fastGasWei","type":"uint256"},{"internalType":"uint256","name":"linkNative","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"offset","type":"uint256"},{"internalType":"uint256","name":"limit","type":"uint256"}],"name":"getActiveUpkeepIDs","outputs":[{"internalType":"uint256[]","name":"upkeeps","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"offset","type":"uint256"},{"internalType":"uint256","name":"limit","type":"uint256"}],"name":"getDetailedUpkeeps","outputs":[{"components":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint96","name":"minAmount","type":"uint96"},{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"uint32","name":"executeGas","type":"uint32"},{"internalType":"bytes","name":"checkData","type":"bytes"},{"internalType":"uint96","name":"balance","type":"uint96"},{"internalType":"address","name":"admin","type":"address"},{"internalType":"uint64","name":"maxValidBlocknumber","type":"uint64"},{"internalType":"uint32","name":"lastPerformBlockNumber","type":"uint32"},{"internalType":"uint96","name":"amountSpent","type":"uint96"},{"internalType":"bool","name":"paused","type":"bool"},{"internalType":"bytes","name":"offchainConfig","type":"bytes"}],"internalType":"struct UpkeepInfo","name":"info","type":"tuple"}],"internalType":"struct UpkeepControllerInterface.DetailedUpkeep[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"upkeepId","type":"uint256"}],"name":"getMinBalanceForUpkeep","outputs":[{"internalType":"uint96","name":"","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"offset","type":"uint256"},{"internalType":"uint256","name":"limit","type":"uint256"}],"name":"getMinBalancesForUpkeeps","outputs":[{"internalType":"uint96[]","name":"","type":"uint96[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getState","outputs":[{"components":[{"internalType":"uint32","name":"nonce","type":"uint32"},{"internalType":"uint96","name":"ownerLinkBalance","type":"uint96"},{"internalType":"uint256","name":"expectedLinkBalance","type":"uint256"},{"internalType":"uint96","name":"totalPremium","type":"uint96"},{"internalType":"uint256","name":"numUpkeeps","type":"uint256"},{"internalType":"uint32","name":"configCount","type":"uint32"},{"internalType":"uint32","name":"latestConfigBlockNumber","type":"uint32"},{"internalType":"bytes32","name":"latestConfigDigest","type":"bytes32"},{"internalType":"uint32","name":"latestEpoch","type":"uint32"},{"internalType":"bool","name":"paused","type":"bool"}],"internalType":"struct State","name":"state","type":"tuple"},{"components":[{"internalType":"uint32","name":"paymentPremiumPPB","type":"uint32"},{"internalType":"uint32","name":"flatFeeMicroLink","type":"uint32"},{"internalType":"uint32","name":"checkGasLimit","type":"uint32"},{"internalType":"uint24","name":"stalenessSeconds","type":"uint24"},{"internalType":"uint16","name":"gasCeilingMultiplier","type":"uint16"},{"internalType":"uint96","name":"minUpkeepSpend","type":"uint96"},{"internalType":"uint32","name":"maxPerformGas","type":"uint32"},{"internalType":"uint32","name":"maxCheckDataSize","type":"uint32"},{"internalType":"uint32","name":"maxPerformDataSize","type":"uint32"},{"internalType":"uint256","name":"fallbackGasPrice","type":"uint256"},{"internalType":"uint256","name":"fallbackLinkPrice","type":"uint256"},{"internalType":"address","name":"transcoder","type":"address"},{"internalType":"address","name":"registrar","type":"address"}],"internalType":"struct OnchainConfig","name":"config","type":"tuple"},{"internalType":"address[]","name":"signers","type":"address[]"},{"internalType":"address[]","name":"transmitters","type":"address[]"},{"internalType":"uint8","name":"f","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"upkeepId","type":"uint256"}],"name":"getUpkeep","outputs":[{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"uint32","name":"executeGas","type":"uint32"},{"internalType":"bytes","name":"checkData","type":"bytes"},{"internalType":"uint96","name":"balance","type":"uint96"},{"internalType":"address","name":"admin","type":"address"},{"internalType":"uint64","name":"maxValidBlocknumber","type":"uint64"},{"internalType":"uint32","name":"lastPerformBlockNumber","type":"uint32"},{"internalType":"uint96","name":"amountSpent","type":"uint96"},{"internalType":"bool","name":"paused","type":"bool"},{"internalType":"bytes","name":"offchainConfig","type":"bytes"}],"internalType":"struct UpkeepInfo","name":"upkeepInfo","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"offset","type":"uint256"},{"internalType":"uint256","name":"limit","type":"uint256"}],"name":"getUpkeeps","outputs":[{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"uint32","name":"executeGas","type":"uint32"},{"internalType":"bytes","name":"checkData","type":"bytes"},{"internalType":"uint96","name":"balance","type":"uint96"},{"internalType":"address","name":"admin","type":"address"},{"internalType":"uint64","name":"maxValidBlocknumber","type":"uint64"},{"internalType":"uint32","name":"lastPerformBlockNumber","type":"uint32"},{"internalType":"uint96","name":"amountSpent","type":"uint96"},{"internalType":"bool","name":"paused","type":"bool"},{"internalType":"bytes","name":"offchainConfig","type":"bytes"}],"internalType":"struct UpkeepInfo[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getUpkeepsCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"i_link","outputs":[{"internalType":"contract LinkTokenInterface","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"i_registrar","outputs":[{"internalType":"contract KeeperRegistrarInterface","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"i_registry","outputs":[{"internalType":"contract AutomationRegistryWithMinANeededAmountInterface","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isNewUpkeepNeeded","outputs":[{"internalType":"bool","name":"isNeeded","type":"bool"},{"internalType":"uint256","name":"newOffset","type":"uint256"},{"internalType":"uint256","name":"newLimit","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"upkeepId","type":"uint256"}],"name":"pauseUpkeep","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"string","name":"name","type":"string"},{"internalType":"bytes","name":"encryptedEmail","type":"bytes"},{"internalType":"address","name":"upkeepContract","type":"address"},{"internalType":"uint32","name":"gasLimit","type":"uint32"},{"internalType":"address","name":"adminAddress","type":"address"},{"internalType":"bytes","name":"checkData","type":"bytes"},{"internalType":"bytes","name":"offchainConfig","type":"bytes"},{"internalType":"uint96","name":"amount","type":"uint96"}],"internalType":"struct KeeperRegistrarInterface.RegistrationParams","name":"params","type":"tuple"}],"name":"registerAndPredictID","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"upkeepId","type":"uint256"},{"internalType":"uint32","name":"gasLimit","type":"uint32"}],"name":"setUpkeepGasLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"upkeepId","type":"uint256"},{"internalType":"bytes","name":"config","type":"bytes"}],"name":"setUpkeepOffchainConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"upkeepId","type":"uint256"}],"name":"unpauseUpkeep","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"upkeepId","type":"uint256"},{"internalType":"bytes","name":"newCheckData","type":"bytes"}],"name":"updateCheckData","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106101375760003560e01c8063948108f7116100b8578063c7c3a19a1161007c578063c7c3a19a1461030f578063c80480221461032f578063dbe5dcdf14610342578063e357cd0714610362578063f7d334ba14610378578063fd111cca1461039d57600080fd5b8063948108f71461028b5780639fab43861461029e578063a72aa27e146102b1578063b657bc9c146102c4578063c43322bb146102ef57600080fd5b80635165f2f5116100ff5780635165f2f5146102095780637d253aff1461021e5780637f25c83d146102455780638765ecbe146102655780638dcf0fe71461027857600080fd5b806306e3b6321461013c5780631865c57d146101655780632a6636061461017e57806337d10eac146101bd578063442b1278146101e2575b600080fd5b61014f61014a366004611a93565b6103b0565b60405161015c9190611ab5565b60405180910390f35b61016d61049d565b60405161015c959493929190611c4c565b6101a57f000000000000000000000000e16df59b887e3caa439e0b29b42ba2e7976fd8b281565b6040516001600160a01b03909116815260200161015c565b6101c56105f3565b60408051931515845260208401929092529082015260600161015c565b6101a57f00000000000000000000000057a4a13b35d25ee78e084168abac5ad36025246781565b61021c610217366004611d59565b6107b2565b005b6101a57f000000000000000000000000326c977e6efc84e512bb9c30f76e30c160ed06fb81565b610258610253366004611a93565b6108ab565b60405161015c9190611eb7565b61021c610273366004611d59565b610a03565b61021c610286366004611f19565b610af3565b61021c610299366004611fbc565b610bdb565b61021c6102ac36600461211e565b610e2a565b61021c6102bf366004612181565b610f01565b6102d76102d2366004611d59565b610fe6565b6040516001600160601b03909116815260200161015c565b6103026102fd366004611a93565b611072565b60405161015c91906121a6565b61032261031d366004611d59565b611214565b60405161015c919061222e565b61021c61033d366004611d59565b6112a9565b610355610350366004611a93565b61138d565b60405161015c9190612241565b61036a611520565b60405190815260200161015c565b61038b610386366004611d59565b611531565b60405161015c96959493929190612282565b61021c6103ab366004612300565b6115e4565b606060006103be6000611863565b90508084106103dd575050604080516000815260208101909152610497565b60006103e98486612433565b9050808210156103f65750805b610400858261244b565b6001600160401b0381111561041757610417611fec565b604051908082528060200260200182016040528015610440578160200160208202803683370190505b50925060005b83518110156104935761046461045c8288612433565b60009061186d565b84828151811061047657610476612462565b60209081029190910101528061048b81612478565b915050610446565b5050505b92915050565b6040805161014081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e081018290526101008101829052610120810191909152604080516101a081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e08101829052610100810182905261012081018290526101408101829052610160810182905261018081019190915260608060007f000000000000000000000000e16df59b887e3caa439e0b29b42ba2e7976fd8b26001600160a01b0316631865c57d6040518163ffffffff1660e01b8152600401600060405180830381865afa1580156105ba573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526105e29190810190612672565b945094509450945094509091929394565b60008060008060016106056000611863565b61060f919061244b565b9050600061061d818361186d565b6040516363e1d0cd60e11b8152600481018290529091506000906001600160a01b037f000000000000000000000000e16df59b887e3caa439e0b29b42ba2e7976fd8b2169063c7c3a19a90602401600060405180830381865afa158015610688573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526106b09190810190612816565b905060008082604001518060200190518101906106cd919061294b565b91509150600083600001516001600160a01b0316636e04ff0d85604001516040518263ffffffff1660e01b8152600401610707919061297e565b600060405180830381865afa158015610724573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261074c9190810190612991565b91505060008180602001905181019061076591906129d4565b9050826001600160801b031681511015610780576000610783565b60015b995061078f8385612a64565b6001600160801b03169850826001600160801b0316975050505050505050909192565b6107bd600082611880565b6107e25760405162461bcd60e51b81526004016107d990612a8f565b60405180910390fd5b604051635165f2f560e01b8152600481018290527f000000000000000000000000e16df59b887e3caa439e0b29b42ba2e7976fd8b26001600160a01b031690635165f2f590602401600060405180830381600087803b15801561084457600080fd5b505af1158015610858573d6000803e3d6000fd5b5050505061087081600261189890919063ffffffff16565b5061087c6000826118a4565b5060405181907f7bada562044eb163f6b4003c4553e4e62825344c0418eea087bed5ee05a4745690600090a250565b606060006108b984846103b0565b9050600081516001600160401b038111156108d6576108d6611fec565b60405190808252806020026020018201604052801561090f57816020015b6108fc611a1c565b8152602001906001900390816108f45790505b50905060005b81518110156109fa577f000000000000000000000000e16df59b887e3caa439e0b29b42ba2e7976fd8b26001600160a01b031663c7c3a19a84838151811061095f5761095f612462565b60200260200101516040518263ffffffff1660e01b815260040161098591815260200190565b600060405180830381865afa1580156109a2573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526109ca9190810190612816565b8282815181106109dc576109dc612462565b602002602001018190525080806109f290612478565b915050610915565b50949350505050565b610a0e600082611880565b610a2a5760405162461bcd60e51b81526004016107d990612a8f565b6040516343b2f65f60e11b8152600481018290527f000000000000000000000000e16df59b887e3caa439e0b29b42ba2e7976fd8b26001600160a01b031690638765ecbe90602401600060405180830381600087803b158015610a8c57600080fd5b505af1158015610aa0573d6000803e3d6000fd5b50505050610ab88160026118a490919063ffffffff16565b50610ac4600082611898565b5060405181907f8ab10247ce168c27748e656ecf852b951fcaac790c18106b19aa0ae57a8b741f90600090a250565b610afe600084611880565b610b1a5760405162461bcd60e51b81526004016107d990612a8f565b604051638dcf0fe760e01b81526001600160a01b037f000000000000000000000000e16df59b887e3caa439e0b29b42ba2e7976fd8b21690638dcf0fe790610b6a90869086908690600401612ae1565b600060405180830381600087803b158015610b8457600080fd5b505af1158015610b98573d6000803e3d6000fd5b50505050827f3e8740446213c8a77d40e08f79136ce3f347d13ed270a6ebdf57159e0faf48508383604051610bce929190612b04565b60405180910390a2505050565b610be6600083611880565b610c025760405162461bcd60e51b81526004016107d990612a8f565b6040516323b872dd60e01b81523360048201523060248201526001600160601b03821660448201527f000000000000000000000000326c977e6efc84e512bb9c30f76e30c160ed06fb6001600160a01b0316906323b872dd906064016020604051808303816000875af1158015610c7d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ca19190612b18565b5060405163095ea7b360e01b81526001600160a01b037f000000000000000000000000e16df59b887e3caa439e0b29b42ba2e7976fd8b2811660048301526001600160601b03831660248301527f000000000000000000000000326c977e6efc84e512bb9c30f76e30c160ed06fb169063095ea7b3906044016020604051808303816000875af1158015610d39573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d5d9190612b18565b5060405163948108f760e01b8152600481018390526001600160601b03821660248201527f000000000000000000000000e16df59b887e3caa439e0b29b42ba2e7976fd8b26001600160a01b03169063948108f790604401600060405180830381600087803b158015610dcf57600080fd5b505af1158015610de3573d6000803e3d6000fd5b50506040516001600160601b03841681528492507f8137dc366612bf502338bd8951f835ad8ceba421c4eb3d79c7f9b3ce0ac4762e91506020015b60405180910390a25050565b610e35600083611880565b610e515760405162461bcd60e51b81526004016107d990612a8f565b604051634fd5a1c360e11b81526001600160a01b037f000000000000000000000000e16df59b887e3caa439e0b29b42ba2e7976fd8b21690639fab438690610e9f9085908590600401612b33565b600060405180830381600087803b158015610eb957600080fd5b505af1158015610ecd573d6000803e3d6000fd5b50505050817f86aa972e9fc0c705fea6a70adc998117ea6a33853d380b06d3a4e777f4e5203a82604051610e1e919061297e565b610f0c600083611880565b610f285760405162461bcd60e51b81526004016107d990612a8f565b604051635395513f60e11b81526004810183905263ffffffff821660248201527f000000000000000000000000e16df59b887e3caa439e0b29b42ba2e7976fd8b26001600160a01b03169063a72aa27e90604401600060405180830381600087803b158015610f9657600080fd5b505af1158015610faa573d6000803e3d6000fd5b505060405163ffffffff841681528492507f6e922e3c48062403590addb8e090d556398efe9371d97f454fc4b10b562ae5909150602001610e1e565b604051632d95ef2760e21b8152600481018290526000907f000000000000000000000000e16df59b887e3caa439e0b29b42ba2e7976fd8b26001600160a01b03169063b657bc9c90602401602060405180830381865afa15801561104e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104979190612b4c565b6060600061108084846103b0565b80519091508085106110c75760408051600080825260208201909252906110bd565b6110aa611a6f565b8152602001906001900390816110a25790505b5092505050610497565b60006110d38587612433565b9050808210156110e05750805b60006110ec878361244b565b6001600160401b0381111561110357611103611fec565b60405190808252806020026020018201604052801561113c57816020015b611129611a6f565b8152602001906001900390816111215790505b509050600061114b88886108ab565b90506000611159898961138d565b905060005b835181101561120657604051806060016040528088838151811061118457611184612462565b602002602001015181526020018383815181106111a3576111a3612462565b60200260200101516001600160601b031681526020018483815181106111cb576111cb612462565b60200260200101518152508482815181106111e8576111e8612462565b602002602001018190525080806111fe90612478565b91505061115e565b509198975050505050505050565b61121c611a1c565b6040516363e1d0cd60e11b8152600481018390527f000000000000000000000000e16df59b887e3caa439e0b29b42ba2e7976fd8b26001600160a01b03169063c7c3a19a90602401600060405180830381865afa158015611281573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526104979190810190612816565b6112b4600082611880565b6112d05760405162461bcd60e51b81526004016107d990612a8f565b604051636402401160e11b8152600481018290527f000000000000000000000000e16df59b887e3caa439e0b29b42ba2e7976fd8b26001600160a01b03169063c804802290602401600060405180830381600087803b15801561133257600080fd5b505af1158015611346573d6000803e3d6000fd5b5050505061135e81600061189890919063ffffffff16565b5060405181907fa08e5e152c9438f8441ddfe294ad3b09457b826764a94e320a40b228cf2d410a90600090a250565b6060600061139b84846103b0565b80519091508085106113bd5760408051600080825260208201909252906110bd565b60006113c98587612433565b9050808210156113d65750805b60006113e2878361244b565b6001600160401b038111156113f9576113f9611fec565b604051908082528060200260200182016040528015611422578160200160208202803683370190505b50905060005b8151811015611515577f000000000000000000000000e16df59b887e3caa439e0b29b42ba2e7976fd8b26001600160a01b031663b657bc9c86838151811061147257611472612462565b60200260200101516040518263ffffffff1660e01b815260040161149891815260200190565b602060405180830381865afa1580156114b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114d99190612b4c565b8282815181106114eb576114eb612462565b6001600160601b03909216602092830291909101909101528061150d81612478565b915050611428565b509695505050505050565b600061152c6000611863565b905090565b600060606000806000807f000000000000000000000000e16df59b887e3caa439e0b29b42ba2e7976fd8b26001600160a01b031663f7d334ba886040518263ffffffff1660e01b815260040161158991815260200190565b6000604051808303816000875af11580156115a8573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526115d09190810190612b69565b949c939b5091995097509550909350915050565b60e08101516040516323b872dd60e01b81523360048201523060248201526001600160601b0390911660448201527f000000000000000000000000326c977e6efc84e512bb9c30f76e30c160ed06fb6001600160a01b0316906323b872dd906064016020604051808303816000875af1158015611665573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116899190612b18565b5060e081015160405163095ea7b360e01b81526001600160a01b037f00000000000000000000000057a4a13b35d25ee78e084168abac5ad360252467811660048301526001600160601b0390921660248201527f000000000000000000000000326c977e6efc84e512bb9c30f76e30c160ed06fb9091169063095ea7b3906044016020604051808303816000875af1158015611729573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061174d9190612b18565b5060405163022de76960e21b81526000906001600160a01b037f00000000000000000000000057a4a13b35d25ee78e084168abac5ad36025246716906308b79da49061179d908590600401612bea565b6020604051808303816000875af11580156117bc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117e09190612ccd565b90508015611823576117f36000826118a4565b5060405181907f73827404e930da1450aa92d0348dd0939840f4850415c6b42a1bcf9de4162d7b90600090a25050565b60405162461bcd60e51b8152602060048201526015602482015274185d5d1bcb585c1c1c9bdd9948191a5cd8589b1959605a1b60448201526064016107d9565b6000610497825490565b600061187983836118b0565b9392505050565b60008181526001830160205260408120541515611879565b600061187983836118da565b600061187983836119cd565b60008260000182815481106118c7576118c7612462565b9060005260206000200154905092915050565b600081815260018301602052604081205480156119c35760006118fe60018361244b565b85549091506000906119129060019061244b565b905081811461197757600086600001828154811061193257611932612462565b906000526020600020015490508087600001848154811061195557611955612462565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061198857611988612ce6565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610497565b6000915050610497565b6000818152600183016020526040812054611a1457508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610497565b506000610497565b604080516101408101825260008082526020820181905260609282018390528282018190526080820181905260a0820181905260c0820181905260e0820181905261010082015261012081019190915290565b6040805160608101825260008082526020820152908101611a8e611a1c565b905290565b60008060408385031215611aa657600080fd5b50508035926020909101359150565b6020808252825182820181905260009190848201906040850190845b81811015611aed57835183529284019291840191600101611ad1565b50909695505050505050565b805163ffffffff1682526020810151611b1a602084018263ffffffff169052565b506040810151611b32604084018263ffffffff169052565b506060810151611b49606084018262ffffff169052565b506080810151611b5f608084018261ffff169052565b5060a0810151611b7a60a08401826001600160601b03169052565b5060c0810151611b9260c084018263ffffffff169052565b5060e0810151611baa60e084018263ffffffff169052565b506101008181015163ffffffff811684830152505061012081810151908301526101408082015190830152610160808201516001600160a01b038116828501525050610180818101516001600160a01b038116848301525b50505050565b600081518084526020808501945080840160005b83811015611c415781516001600160a01b031687529582019590820190600101611c1c565b509495945050505050565b855163ffffffff16815260006103406020880151611c7560208501826001600160601b03169052565b50604088015160408401526060880151611c9a60608501826001600160601b03169052565b506080880151608084015260a0880151611cbc60a085018263ffffffff169052565b5060c0880151611cd460c085018263ffffffff169052565b5060e088015160e084015261010080890151611cf78286018263ffffffff169052565b505061012088810151151590840152611d14610140840188611af9565b806102e0840152611d2781840187611c08565b9050828103610300840152611d3c8186611c08565b915050611d4f61032083018460ff169052565b9695505050505050565b600060208284031215611d6b57600080fd5b5035919050565b60005b83811015611d8d578181015183820152602001611d75565b83811115611c025750506000910152565b60008151808452611db6816020860160208601611d72565b601f01601f19169290920160200192915050565b80516001600160a01b0316825260006101406020830151611df3602086018263ffffffff169052565b506040830151816040860152611e0b82860182611d9e565b9150506060830151611e2860608601826001600160601b03169052565b506080830151611e4360808601826001600160a01b03169052565b5060a0830151611e5e60a08601826001600160401b03169052565b5060c0830151611e7660c086018263ffffffff169052565b5060e0830151611e9160e08601826001600160601b03169052565b50610100838101511515908501526101208084015185830382870152611d4f8382611d9e565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015611f0c57603f19888603018452611efa858351611dca565b94509285019290850190600101611ede565b5092979650505050505050565b600080600060408486031215611f2e57600080fd5b8335925060208401356001600160401b0380821115611f4c57600080fd5b818601915086601f830112611f6057600080fd5b813581811115611f6f57600080fd5b876020828501011115611f8157600080fd5b6020830194508093505050509250925092565b6001600160601b0381168114611fa957600080fd5b50565b8035611fb781611f94565b919050565b60008060408385031215611fcf57600080fd5b823591506020830135611fe181611f94565b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b60405161010081016001600160401b038111828210171561202557612025611fec565b60405290565b6040516101a081016001600160401b038111828210171561202557612025611fec565b60405161014081016001600160401b038111828210171561202557612025611fec565b604051601f8201601f191681016001600160401b038111828210171561209957612099611fec565b604052919050565b60006001600160401b038211156120ba576120ba611fec565b50601f01601f191660200190565b600082601f8301126120d957600080fd5b81356120ec6120e7826120a1565b612071565b81815284602083860101111561210157600080fd5b816020850160208301376000918101602001919091529392505050565b6000806040838503121561213157600080fd5b8235915060208301356001600160401b0381111561214e57600080fd5b61215a858286016120c8565b9150509250929050565b63ffffffff81168114611fa957600080fd5b8035611fb781612164565b6000806040838503121561219457600080fd5b823591506020830135611fe181612164565b60006020808301818452808551808352604092508286019150828160051b87010184880160005b8381101561222057888303603f19018552815180518452878101516001600160601b031688850152860151606087850181905261220c81860183611dca565b9689019694505050908601906001016121cd565b509098975050505050505050565b6020815260006118796020830184611dca565b6020808252825182820181905260009190848201906040850190845b81811015611aed5783516001600160601b03168352928401929184019160010161225d565b861515815260c06020820152600061229d60c0830188611d9e565b9050600786106122bd57634e487b7160e01b600052602160045260246000fd5b8560408301528460608301528360808301528260a0830152979650505050505050565b6001600160a01b0381168114611fa957600080fd5b8035611fb7816122e0565b60006020828403121561231257600080fd5b81356001600160401b038082111561232957600080fd5b90830190610100828603121561233e57600080fd5b612346612002565b82358281111561235557600080fd5b612361878286016120c8565b82525060208301358281111561237657600080fd5b612382878286016120c8565b602083015250612394604084016122f5565b60408201526123a560608401612176565b60608201526123b6608084016122f5565b608082015260a0830135828111156123cd57600080fd5b6123d9878286016120c8565b60a08301525060c0830135828111156123f157600080fd5b6123fd878286016120c8565b60c08301525061240f60e08401611fac565b60e082015295945050505050565b634e487b7160e01b600052601160045260246000fd5b600082198211156124465761244661241d565b500190565b60008282101561245d5761245d61241d565b500390565b634e487b7160e01b600052603260045260246000fd5b600060001982141561248c5761248c61241d565b5060010190565b8051611fb781612164565b8051611fb781611f94565b80518015158114611fb757600080fd5b805162ffffff81168114611fb757600080fd5b805161ffff81168114611fb757600080fd5b8051611fb7816122e0565b60006101a082840312156124fc57600080fd5b61250461202b565b905061250f82612493565b815261251d60208301612493565b602082015261252e60408301612493565b604082015261253f606083016124b9565b6060820152612550608083016124cc565b608082015261256160a0830161249e565b60a082015261257260c08301612493565b60c082015261258360e08301612493565b60e0820152610100612596818401612493565b90820152610120828101519082015261014080830151908201526101606125be8184016124de565b908201526101806125d08382016124de565b9082015292915050565b60006001600160401b038211156125f3576125f3611fec565b5060051b60200190565b600082601f83011261260e57600080fd5b8151602061261e6120e7836125da565b82815260059290921b8401810191818101908684111561263d57600080fd5b8286015b84811015611515578051612654816122e0565b8352918301918301612641565b805160ff81168114611fb757600080fd5b600080600080600085870361034081121561268c57600080fd5b6101408082121561269c57600080fd5b6126a461204e565b91506126af88612493565b82526126bd6020890161249e565b6020830152604088015160408301526126d86060890161249e565b6060830152608088015160808301526126f360a08901612493565b60a083015261270460c08901612493565b60c083015260e088015160e0830152610100612721818a01612493565b908301526101206127338982016124a9565b818401525081965061274789828a016124e9565b955050506102e08601516001600160401b038082111561276657600080fd5b61277289838a016125fd565b945061030088015191508082111561278957600080fd5b50612796888289016125fd565b9250506127a66103208701612661565b90509295509295909350565b600082601f8301126127c357600080fd5b81516127d16120e7826120a1565b8181528460208386010111156127e657600080fd5b6127f7826020830160208701611d72565b949350505050565b80516001600160401b0381168114611fb757600080fd5b60006020828403121561282857600080fd5b81516001600160401b038082111561283f57600080fd5b90830190610140828603121561285457600080fd5b61285c61204e565b612865836124de565b815261287360208401612493565b602082015260408301518281111561288a57600080fd5b612896878286016127b2565b6040830152506128a86060840161249e565b60608201526128b9608084016124de565b60808201526128ca60a084016127ff565b60a08201526128db60c08401612493565b60c08201526128ec60e0840161249e565b60e08201526101006128ff8185016124a9565b90820152610120838101518381111561291757600080fd5b612923888287016127b2565b918301919091525095945050505050565b80516001600160801b0381168114611fb757600080fd5b6000806040838503121561295e57600080fd5b61296783612934565b915061297560208401612934565b90509250929050565b6020815260006118796020830184611d9e565b600080604083850312156129a457600080fd5b6129ad836124a9565b915060208301516001600160401b038111156129c857600080fd5b61215a858286016127b2565b600060208083850312156129e757600080fd5b82516001600160401b038111156129fd57600080fd5b8301601f81018513612a0e57600080fd5b8051612a1c6120e7826125da565b81815260059190911b82018301908381019087831115612a3b57600080fd5b928401925b82841015612a5957835182529284019290840190612a40565b979650505050505050565b60006001600160801b03808316818516808303821115612a8657612a8661241d565b01949350505050565b6020808252600f908201526e15dc9bdb99c81d5c1ad9595c081a59608a1b604082015260600190565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b838152604060208201526000612afb604083018486612ab8565b95945050505050565b6020815260006127f7602083018486612ab8565b600060208284031215612b2a57600080fd5b611879826124a9565b8281526040602082015260006127f76040830184611d9e565b600060208284031215612b5e57600080fd5b815161187981611f94565b60008060008060008060c08789031215612b8257600080fd5b612b8b876124a9565b955060208701516001600160401b03811115612ba657600080fd5b612bb289828a016127b2565b955050604087015160078110612bc757600080fd5b80945050606087015192506080870151915060a087015190509295509295509295565b6020815260008251610100806020850152612c09610120850183611d9e565b91506020850151601f1980868503016040870152612c278483611d9e565b935060408701519150612c4560608701836001600160a01b03169052565b606087015163ffffffff81166080880152915060808701516001600160a01b03811660a0880152915060a08701519150808685030160c0870152612c898483611d9e565b935060c08701519150808685030160e087015250612ca78382611d9e565b92505060e0850151612cc3828601826001600160601b03169052565b5090949350505050565b600060208284031215612cdf57600080fd5b5051919050565b634e487b7160e01b600052603160045260246000fdfea26469706673582212207acfbc9b9bc5d65048397f7f43cb935bcf59243e68adb3c02b7a44756a1e725e64736f6c634300080c0033
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.