Sepolia Testnet

Contract

0x4d9bC98452820FD96B2C31741e8C4DdcC795bEce
Transaction Hash
Method
Block
From
To
Value
Register As Keep...41606882023-08-25 23:06:00215 days ago1693004760IN
0x4d9bC984...cC795bEce
0 ETH0.000039331.5
Register As Keep...41595932023-08-25 19:08:36215 days ago1692990516IN
0x4d9bC984...cC795bEce
0 ETH0.0003991515.2209966
Register As Keep...41204442023-08-19 17:43:48221 days ago1692467028IN
0x4d9bC984...cC795bEce
0 ETH0.000721694.16055266
Register As Keep...41084132023-08-17 18:52:36223 days ago1692298356IN
0x4d9bC984...cC795bEce
0 ETH0.00045514.36896874
Register As Keep...41083742023-08-17 18:43:36223 days ago1692297816IN
0x4d9bC984...cC795bEce
0 ETH0.000493494.73746033
Register As Keep...41083262023-08-17 18:31:48223 days ago1692297108IN
0x4d9bC984...cC795bEce
0 ETH0.000520895.00050774
Register As Keep...41083142023-08-17 18:28:36223 days ago1692296916IN
0x4d9bC984...cC795bEce
0 ETH0.000642486.1677993
Disable Keeper41060322023-08-17 9:34:36223 days ago1692264876IN
0x4d9bC984...cC795bEce
0 ETH0.00041878.48954713
Register As Keep...41024502023-08-16 19:29:12224 days ago1692214152IN
0x4d9bC984...cC795bEce
0 ETH0.000449042.5887384
Register As Keep...41023932023-08-16 19:15:48224 days ago1692213348IN
0x4d9bC984...cC795bEce
0 ETH0.000494522.85090854
Initiate Redeem39493262023-07-23 14:00:48248 days ago1690120848IN
0x4d9bC984...cC795bEce
0 ETH0.000096434
Initiate Redeem39493222023-07-23 13:59:48248 days ago1690120788IN
0x4d9bC984...cC795bEce
0 ETH0.000096434
Finalize Redeem39493142023-07-23 13:58:12248 days ago1690120692IN
0x4d9bC984...cC795bEce
0 ETH0.000098084
Initiate Redeem39492972023-07-23 13:54:24248 days ago1690120464IN
0x4d9bC984...cC795bEce
0 ETH0.000048292.00000001
Deposit Job Owne...38567162023-07-09 11:04:24262 days ago1688900664IN
0x4d9bC984...cC795bEce
0.3 ETH0.000257195
Finalize Redeem37615972023-06-25 1:44:24277 days ago1687657464IN
0x4d9bC984...cC795bEce
0 ETH0.000066651.50000004
Initiate Redeem37611262023-06-25 0:07:12277 days ago1687651632IN
0x4d9bC984...cC795bEce
0 ETH0.000123991.50007841
Finalize Redeem37480262023-06-23 2:38:00279 days ago1687487880IN
0x4d9bC984...cC795bEce
0 ETH0.000094381.53390341
Finalize Redeem37464662023-06-22 20:58:24279 days ago1687467504IN
0x4d9bC984...cC795bEce
0 ETH0.000136593.07405869
Finalize Redeem37463582023-06-22 20:35:00279 days ago1687466100IN
0x4d9bC984...cC795bEce
0 ETH0.0005325111.98747861
Initiate Redeem37442392023-06-22 12:39:24279 days ago1687437564IN
0x4d9bC984...cC795bEce
0 ETH0.000569636.89308441
Withdraw Job Own...37435902023-06-22 10:18:00279 days ago1687429080IN
0x4d9bC984...cC795bEce
0 ETH0.000098443.06565681
Register As Keep...37431952023-06-22 8:49:00280 days ago1687423740IN
0x4d9bC984...cC795bEce
0 ETH0.00086735
Set Job Config37431172023-06-22 8:31:12280 days ago1687422672IN
0x4d9bC984...cC795bEce
0 ETH0.000198675
Set Job Config37430952023-06-22 8:25:48280 days ago1687422348IN
0x4d9bC984...cC795bEce
0 ETH0.000218625
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Txn Hash Block From To Value
37435902023-06-22 10:18:00279 days ago1687429080
0x4d9bC984...cC795bEce
0.09999999 ETH
36362372023-06-06 16:23:12295 days ago1686068592
0x4d9bC984...cC795bEce
123 wei
36048112023-06-01 21:32:36300 days ago1685655156
0x4d9bC984...cC795bEce
79 wei
36048102023-06-01 21:32:12300 days ago1685655132
0x4d9bC984...cC795bEce
68 wei
36048082023-06-01 21:31:48300 days ago1685655108
0x4d9bC984...cC795bEce
68 wei
36048082023-06-01 21:31:48300 days ago1685655108
0x4d9bC984...cC795bEce
79 wei
36048062023-06-01 21:31:24300 days ago1685655084
0x4d9bC984...cC795bEce
68 wei
36048052023-06-01 21:31:12300 days ago1685655072
0x4d9bC984...cC795bEce
79 wei
36048032023-06-01 21:30:48300 days ago1685655048
0x4d9bC984...cC795bEce
79 wei
36048012023-06-01 21:30:24300 days ago1685655024
0x4d9bC984...cC795bEce
68 wei
36048012023-06-01 21:30:24300 days ago1685655024
0x4d9bC984...cC795bEce
79 wei
36047992023-06-01 21:30:00300 days ago1685655000
0x4d9bC984...cC795bEce
68 wei
36047972023-06-01 21:29:36300 days ago1685654976
0x4d9bC984...cC795bEce
68 wei
36047972023-06-01 21:29:36300 days ago1685654976
0x4d9bC984...cC795bEce
68 wei
36047942023-06-01 21:29:00300 days ago1685654940
0x4d9bC984...cC795bEce
68 wei
36047922023-06-01 21:28:36300 days ago1685654916
0x4d9bC984...cC795bEce
68 wei
36047902023-06-01 21:28:12300 days ago1685654892
0x4d9bC984...cC795bEce
68 wei
36047882023-06-01 21:27:48300 days ago1685654868
0x4d9bC984...cC795bEce
68 wei
36047862023-06-01 21:27:24300 days ago1685654844
0x4d9bC984...cC795bEce
68 wei
36047842023-06-01 21:27:00300 days ago1685654820
0x4d9bC984...cC795bEce
68 wei
36047822023-06-01 21:26:36300 days ago1685654796
0x4d9bC984...cC795bEce
68 wei
36047802023-06-01 21:26:12300 days ago1685654772
0x4d9bC984...cC795bEce
68 wei
36047782023-06-01 21:25:36300 days ago1685654736
0x4d9bC984...cC795bEce
68 wei
36047762023-06-01 21:25:12300 days ago1685654712
0x4d9bC984...cC795bEce
68 wei
36047742023-06-01 21:24:48300 days ago1685654688
0x4d9bC984...cC795bEce
68 wei
View All Internal Transactions
Loading...
Loading

Similar Match Source Code
This contract matches the deployed Bytecode of the Source Code for Contract 0xa1DB7bb4...73e5437f6
The constructor portion of the code might be different and could alter the actual behaviour of the contract

Contract Name:
PPAgentV2Randao

Compiler Version
v0.8.17+commit.8df45f5f

Optimization Enabled:
Yes with 1500 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 10 of 10 : PPAgentV2Randao.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import { PPAgentV2, ConfigFlags } from "./PPAgentV2.sol";
import "./PPAgentV2Flags.sol";
import "./PPAgentV2Interfaces.sol";

/**
 * @title PPAgentV2Randao
 * @author PowerPool
 */
contract PPAgentV2Randao is IPPAgentV2RandaoViewer, PPAgentV2 {
  using EnumerableSet for EnumerableSet.Bytes32Set;
  using EnumerableSet for EnumerableSet.UintSet;

  error JobHasKeeperAssigned(uint256 keeperId);
  error SlashingEpochBlocksTooLow();
  error InvalidPeriod1();
  error InvalidPeriod2();
  error InvalidSlashingFeeFixedCVP();
  error SlashingBpsGt5000Bps();
  error InvalidStakeDivisor();
  error InactiveKeeper();
  error KeeperIsAssignedToJobs(uint256 amountOfJobs);
  error OnlyCurrentSlasher(uint256 expectedSlasherId);
  error OnlyReservedSlasher(uint256 reservedSlasherId);
  error TooEarlyForSlashing(uint256 now_, uint256 possibleAfter);
  error SlashingNotInitiated();
  error SlashingNotInitiatedExecutionReverted();
  error KeeperCantSlash();
  error KeeperIsAlreadyActive();
  error KeeperIsAlreadyInactive();
  error CantAssignKeeper();
  error UnexpectedCodeBlock();
  error InitiateSlashingUnexpectedError();
  error NonIntervalJob();
  error JobCheckResolverError(bytes errReason);
  error JobCheckResolverReturnedFalse();
  error TooEarlyToReinitiateSlashing();
  error JobCheckCanBeExecuted();
  error JobCheckCanNotBeExecuted(bytes errReason);
  error TooEarlyToRelease(bytes32 jobKey, uint256 period2End);
  error TooEarlyForActivationFinalization(uint256 now, uint256 availableAt);
  error CantRelease();
  error OnlyNextKeeper(
    uint256 expectedKeeperId,
    uint256 lastExecutedAt,
    uint256 interval,
    uint256 slashingInterval,
    uint256 _now
  );
  error InsufficientKeeperStakeToSlash(
    bytes32 jobKey,
    uint256 expectedKeeperId,
    uint256 keeperCurrentStake,
    uint256 amountToSlash
  );

  event DisableKeeper(uint256 indexed keeperId);
  event InitiateKeeperActivation(uint256 indexed keeperId, uint256 canBeFinalizedAt);
  event FinalizeKeeperActivation(uint256 indexed keeperId);
  event InitiateSlashing(
    bytes32 indexed jobKey,
    uint256 indexed slasherKeeperId,
    bool useResolver,
    uint256 jobSlashingPossibleAfter
  );
  event ExecutionReverted(
    bytes32 indexed jobKey,
    uint256 indexed keeperId,
    bytes executionReturndata
  );
  event SlashIntervalJob(
    bytes32 indexed jobKey,
    uint256 indexed expectedKeeperId,
    uint256 indexed actualKeeperId,
    uint256 fixedSlashAmount,
    uint256 dynamicSlashAmount
  );
  event SetRdConfig(RandaoConfig rdConfig);
  event JobKeeperChanged(bytes32 indexed jobKey, uint256 indexed keeperFrom, uint256 indexed keeperTo);

  IPPAgentV2RandaoViewer.RandaoConfig internal rdConfig;

  // keccak256(jobAddress, id) => nextKeeperId
  mapping(bytes32 => uint256) public jobNextKeeperId;
  // keccak256(jobAddress, id) => nextSlasherId
  mapping(bytes32 => uint256) public jobReservedSlasherId;
  // keccak256(jobAddress, id) => timestamp, for non-interval jobs
  mapping(bytes32 => uint256) public jobSlashingPossibleAfter;
  // keccak256(jobAddress, id) => timestamp
  mapping(bytes32 => uint256) public jobCreatedAt;
  // keeperId => (pending jobs)
  mapping(uint256 => EnumerableSet.Bytes32Set) internal keeperLocksByJob;
  // keeperId => timestamp
  mapping(uint256 => uint256) public keeperActivationCanBeFinalizedAt;

  EnumerableSet.UintSet internal activeKeepers;

  function getStrategy() public pure override returns (string memory) {
    return "randao";
  }

  function _getJobGasOverhead() internal pure override returns (uint256) {
    return 55_000;
  }

  constructor(address cvp_) PPAgentV2(cvp_) {
  }

  function initializeRandao(
    address owner_,
    uint256 minKeeperCvp_,
    uint256 pendingWithdrawalTimeoutSeconds_,
    RandaoConfig memory rdConfig_) external {
    PPAgentV2.initialize(owner_, minKeeperCvp_, pendingWithdrawalTimeoutSeconds_);
    _setRdConfig(rdConfig_);
  }

  /*** AGENT OWNER METHODS ***/
  function setRdConfig(RandaoConfig calldata rdConfig_) external onlyOwner {
    _setRdConfig(rdConfig_);
  }

  function _setRdConfig(RandaoConfig memory rdConfig_) internal {
    if (rdConfig_.slashingEpochBlocks < 3) {
      revert SlashingEpochBlocksTooLow();
    }
    if (rdConfig_.period1 < 15 seconds) {
      revert InvalidPeriod1();
    }
    if (rdConfig_.period2 < 15 seconds) {
      revert InvalidPeriod2();
    }
    if (rdConfig_.slashingFeeFixedCVP > (minKeeperCvp / 2)) {
      revert InvalidSlashingFeeFixedCVP();
    }
    if (rdConfig_.slashingFeeBps > 5000) {
      revert SlashingBpsGt5000Bps();
    }
    if (rdConfig_.stakeDivisor == 0) {
      revert InvalidStakeDivisor();
    }
    emit SetRdConfig(rdConfig_);

    rdConfig = rdConfig_;
  }

  /*** JOB OWNER METHODS ***/
  function assignKeeper(bytes32[] calldata jobKeys_) external {
    for (uint256 i = 0; i < jobKeys_.length; i++) {
      bytes32 jobKey = jobKeys_[i];
      uint256 assignedKeeperId = jobNextKeeperId[jobKey];
      if (assignedKeeperId != 0) {
        revert JobHasKeeperAssigned(assignedKeeperId);
      }
      _assertOnlyJobOwner(jobKey);

      if (!_assignNextKeeperIfRequiredAndUpdateLastExecutedAt(jobKey, 0)) {
        revert CantAssignKeeper();
      }
    }
  }

  /*** KEEPER METHODS ***/
  function releaseJob(bytes32 jobKey_) external {
    uint256 assignedKeeperId = jobNextKeeperId[jobKey_];

    // Job owner can unassign a keeper without any restriction
    if (msg.sender == jobOwners[jobKey_]) {
      _releaseKeeper(jobKey_, assignedKeeperId);
      return;
    }
    // Otherwise this is a keeper's call

    _assertOnlyKeeperAdmin(assignedKeeperId);

    uint256 binJob = getJobRaw(jobKey_);
    uint256 intervalSeconds = (binJob << 32) >> 232;

    // 1. Release if insufficient credits
    if (_releaseKeeperIfRequired(jobKey_, assignedKeeperId)) {
      return;
    }

    // 2. Check interval timeouts otherwise
    // 2.1 If interval job
    if (intervalSeconds != 0) {
      uint256 lastExecutionAt = binJob >> 224;
      if (lastExecutionAt == 0) {
        lastExecutionAt = jobCreatedAt[jobKey_];
      }
      uint256 period2EndsAt = lastExecutionAt + rdConfig.period1 + rdConfig.period2;
      if (period2EndsAt > block.timestamp) {
        revert TooEarlyToRelease(jobKey_, period2EndsAt);
      } // else can release
    // 2.2 If resolver job
    } else {
      // if slashing process initiated
      uint256 _jobSlashingPossibleAfter = jobSlashingPossibleAfter[jobKey_];
      if (_jobSlashingPossibleAfter != 0) {
        uint256 period2EndsAt = _jobSlashingPossibleAfter + rdConfig.period2;
        if (period2EndsAt > block.timestamp) {
          revert TooEarlyToRelease(jobKey_, period2EndsAt);
        }
      // if no slashing initiated
      } else {
        revert CantRelease();
      }
    }

    _releaseKeeper(jobKey_, assignedKeeperId);
  }

  function disableKeeper(uint256 keeperId_) external {
    _assertOnlyKeeperAdmin(keeperId_);

    if (!keepers[keeperId_].isActive) {
      revert KeeperIsAlreadyInactive();
    }

    _ensureCanReleaseKeeper(keeperId_);
    activeKeepers.remove(keeperId_);
    keepers[keeperId_].isActive = false;

    emit DisableKeeper(keeperId_);
  }

  function initiateKeeperActivation(uint256 keeperId_) external {
    _assertOnlyKeeperAdmin(keeperId_);

    if (keepers[keeperId_].isActive) {
      revert KeeperIsAlreadyActive();
    }

    uint256 canBeFinalizedAt = block.timestamp + rdConfig.keeperActivationTimeoutHours * 1 hours;
    keeperActivationCanBeFinalizedAt[keeperId_] = canBeFinalizedAt;

    emit InitiateKeeperActivation(keeperId_, canBeFinalizedAt);
  }

  function finalizeKeeperActivation(uint256 keeperId_) external {
    _assertOnlyKeeperAdmin(keeperId_);

    uint256 availableAt = keeperActivationCanBeFinalizedAt[keeperId_];
    if (availableAt > block.timestamp) {
      revert TooEarlyForActivationFinalization(block.timestamp, availableAt);
    }

    activeKeepers.add(keeperId_);
    keepers[keeperId_].isActive = true;
    keeperActivationCanBeFinalizedAt[keeperId_] = 0;

    emit FinalizeKeeperActivation(keeperId_);
  }

  function _afterExecutionReverted(
    bytes32 jobKey_,
    CalldataSourceType calldataSource_,
    uint256 keeperId_,
    bytes memory executionResponse_
  ) internal override {
    if (calldataSource_ == CalldataSourceType.RESOLVER &&
      jobReservedSlasherId[jobKey_] == 0 && jobSlashingPossibleAfter[jobKey_] == 0) {
      revert SlashingNotInitiatedExecutionReverted();
    }

    _releaseKeeper(jobKey_, keeperId_);

    emit ExecutionReverted(jobKey_, keeperId_, executionResponse_);
  }

  function initiateSlashing(
    address jobAddress_,
    uint256 jobId_,
    uint256 slasherKeeperId_,
    bool useResolver_,
    bytes memory jobCalldata_
  ) external {
    bytes32 jobKey = getJobKey(jobAddress_, jobId_);
    uint256 binJob = getJobRaw(jobKey);

    // 0. Keeper has sufficient stake
    {
      Keeper memory keeper = keepers[slasherKeeperId_];
      if (keeper.worker != msg.sender) {
        revert KeeperWorkerNotAuthorized();
      }
      if (keeper.cvpStake < minKeeperCvp) {
        revert InsufficientKeeperStake();
      }
      if (!keeper.isActive) {
        revert InactiveKeeper();
      }
    }

    // 1. Assert the job is active
    {
      if (!ConfigFlags.check(binJob, CFG_ACTIVE)) {
        revert InactiveJob(jobKey);
      }
    }

    // 2. Assert job-scoped keeper's minimum CVP deposit
    if (ConfigFlags.check(binJob, CFG_CHECK_KEEPER_MIN_CVP_DEPOSIT) &&
      keepers[slasherKeeperId_].cvpStake < jobMinKeeperCvp[jobKey]) {
      revert InsufficientJobScopedKeeperStake();
    }

    // 3. Not an interval job
    {
      uint256 intervalSeconds = (binJob << 32) >> 232;
      if (intervalSeconds != 0) {
        revert NonIntervalJob();
      }
    }

    // 4. keeper can't slash
    if (jobNextKeeperId[jobKey] == slasherKeeperId_) {
      revert KeeperCantSlash();
    }

    // 5. current slasher
    {
      uint256 currentSlasherId = getCurrentSlasherId(jobKey);
      if (slasherKeeperId_ != currentSlasherId) {
        revert OnlyCurrentSlasher(currentSlasherId);
      }
    }

    // 6. Slashing not initiated yet
    uint256 _jobSlashingPossibleAfter = jobSlashingPossibleAfter[jobKey];
    // if is already initiated
    if (_jobSlashingPossibleAfter != 0 &&
      // but not overdue yet
      (_jobSlashingPossibleAfter + rdConfig.period2) > block.timestamp
      ) {
      revert TooEarlyToReinitiateSlashing();
    }

    // 7. check if could be executed
    if (useResolver_) {
      IPPAgentV2Viewer.Resolver memory resolver = resolvers[jobKey];
      (bool ok, bytes memory result) = resolver.resolverAddress.call(resolver.resolverCalldata);
      if (!ok) {
        revert JobCheckResolverError(result);
      }
      (bool canExecute,) = abi.decode(result, (bool, bytes));
      if (!canExecute) {
        revert JobCheckResolverReturnedFalse();
      } // else can be executed
    } else {
      (bool ok, bytes memory result) = address(this).call(
        abi.encodeWithSelector(PPAgentV2Randao.checkCouldBeExecuted.selector, jobAddress_, jobCalldata_)
      );
      if (ok) {
        revert UnexpectedCodeBlock();
      }
      bytes4 selector = bytes4(result);
      if (selector == PPAgentV2Randao.JobCheckCanNotBeExecuted.selector) {
        assembly ("memory-safe") {
            revert(add(32, result), mload(result))
        }
      } else if (selector != PPAgentV2Randao.JobCheckCanBeExecuted.selector) {
        revert InitiateSlashingUnexpectedError();
      } // else can be executed
    }

    jobReservedSlasherId[jobKey] = slasherKeeperId_;
    _jobSlashingPossibleAfter = block.timestamp + rdConfig.period1;
    jobSlashingPossibleAfter[jobKey] = _jobSlashingPossibleAfter;

    emit InitiateSlashing(jobKey, slasherKeeperId_, useResolver_, _jobSlashingPossibleAfter);
  }

  /*** OVERRIDES ***/
  function registerAsKeeper(address worker_, uint256 initialDepositAmount_) public override returns (uint256 keeperId) {
    keeperId = super.registerAsKeeper(worker_, initialDepositAmount_);
    activeKeepers.add(keeperId);
  }

  function setJobConfig(
    bytes32 jobKey_,
    bool isActive_,
    bool useJobOwnerCredits_,
    bool assertResolverSelector_
  ) public override {
    uint256 rawJobBefore = getJobRaw(jobKey_);
    super.setJobConfig(jobKey_, isActive_, useJobOwnerCredits_, assertResolverSelector_);
    bool wasActiveBefore = ConfigFlags.check(rawJobBefore, CFG_ACTIVE);
    uint256 expectedKeeperId = jobNextKeeperId[jobKey_];

    // inactive => active: assign if required
    if(!wasActiveBefore && isActive_)  {
      _assignNextKeeperIfRequiredAndUpdateLastExecutedAt(jobKey_, expectedKeeperId);
    }

    // job was and remain active, but the credits source has changed: assign or release if requried
    if (wasActiveBefore && isActive_ &&
      (ConfigFlags.check(rawJobBefore, CFG_USE_JOB_OWNER_CREDITS) != useJobOwnerCredits_)) {

      if (!_assignNextKeeperIfRequiredAndUpdateLastExecutedAt(jobKey_, expectedKeeperId)) {
        _releaseKeeperIfRequired(jobKey_, expectedKeeperId);
      }
    }

    // active => inactive: unassign
    if (wasActiveBefore && !isActive_) {
      _releaseKeeper(jobKey_, expectedKeeperId);
    }
  }

  /*** HOOKS ***/
  function _beforeExecute(bytes32 jobKey_, uint256 actualKeeperId_, uint256 binJob_) internal view override {
    uint256 nextKeeperId = jobNextKeeperId[jobKey_];
    uint256 intervalSeconds = (binJob_ << 32) >> 232;
    uint256 lastExecutionAt = binJob_ >> 224;

    // if interval task is called by a slasher
    if (intervalSeconds > 0 && nextKeeperId != actualKeeperId_) {
      uint256 nextExecutionTimeoutAt;
      uint256 _lastExecutionAt = lastExecutionAt;
      if (_lastExecutionAt == 0) {
        _lastExecutionAt = jobCreatedAt[jobKey_];
      }
      unchecked {
        nextExecutionTimeoutAt = _lastExecutionAt + intervalSeconds + rdConfig.period1;
      }
      // if it is to early to slash this job
      if (block.timestamp < nextExecutionTimeoutAt) {
        revert OnlyNextKeeper(nextKeeperId, lastExecutionAt, intervalSeconds, rdConfig.period1, block.timestamp);
      }

      uint256 currentSlasherId = getCurrentSlasherId(jobKey_);
      if (actualKeeperId_ != currentSlasherId) {
        revert OnlyCurrentSlasher(currentSlasherId);
      }
    // if a resolver job is called by a slasher
    } else  if (intervalSeconds == 0 && nextKeeperId != actualKeeperId_) {
      uint256 _jobSlashingPossibleAfter = jobSlashingPossibleAfter[jobKey_];
      if (_jobSlashingPossibleAfter == 0) {
        revert SlashingNotInitiated();
      }
      if (_jobSlashingPossibleAfter > block.timestamp) {
        revert TooEarlyForSlashing(block.timestamp, jobSlashingPossibleAfter[jobKey_]);
      }

      uint256 _jobReservedSlasherId = jobReservedSlasherId[jobKey_];
      if (_jobReservedSlasherId != actualKeeperId_) {
        revert OnlyReservedSlasher(_jobReservedSlasherId);
      }
    }
  }

  function _afterDepositJobCredits(bytes32 jobKey_) internal override {
    _assignNextKeeperIfRequiredAndUpdateLastExecutedAt(jobKey_, jobNextKeeperId[jobKey_]);
  }

  function _afterWithdrawJobCredits(bytes32 jobKey_) internal override {
    _releaseKeeperIfRequired(jobKey_, jobNextKeeperId[jobKey_]);
  }

  function _afterExecutionSucceeded(bytes32 jobKey_, uint256 actualKeeperId_, uint256 binJob_) internal override {
    uint256 expectedKeeperId = jobNextKeeperId[jobKey_];

    uint256 intervalSeconds = (binJob_ << 32) >> 232;

    if (intervalSeconds == 0) {
      jobReservedSlasherId[jobKey_] = 0;
      jobSlashingPossibleAfter[jobKey_] = 0;
    }

    // if slashing
    if (expectedKeeperId != actualKeeperId_) {
      Keeper memory eKeeper = keepers[expectedKeeperId];
      uint256 dynamicSlashAmount = eKeeper.cvpStake * uint256(rdConfig.slashingFeeBps) / 10_000;
      uint256 fixedSlashAmount = uint256(rdConfig.slashingFeeFixedCVP) * 1 ether;
      // NOTICE: totalSlashAmount can't be >= uint88
      uint88 totalSlashAmount = uint88(fixedSlashAmount + dynamicSlashAmount);
      if (totalSlashAmount > eKeeper.cvpStake) {
        // Actually this block should not be reached, so this is just in case
        revert InsufficientKeeperStakeToSlash(jobKey_, expectedKeeperId, eKeeper.cvpStake, totalSlashAmount);
      }
      keepers[expectedKeeperId].cvpStake -= totalSlashAmount;
      keepers[actualKeeperId_].cvpStake += totalSlashAmount;
      emit SlashIntervalJob(jobKey_, expectedKeeperId, actualKeeperId_, fixedSlashAmount, dynamicSlashAmount);
    }

    if (shouldAssignKeeper(jobKey_)) {
      _unassignKeeper(jobKey_, expectedKeeperId);
      _assignNextKeeper(jobKey_, expectedKeeperId);
    } else {
      _releaseKeeper(jobKey_, expectedKeeperId);
    }
  }

  function _beforeInitiateRedeem(uint256 keeperId_) internal view override {
    _ensureCanReleaseKeeper(keeperId_);
  }

  function _afterRegisterJob(bytes32 jobKey_) internal override {
    jobCreatedAt[jobKey_] = block.timestamp;
    _assignNextKeeperIfRequired(jobKey_, 0);
  }

  /*** HELPERS ***/
  function _releaseKeeper(bytes32 jobKey_, uint256 keeperId_) internal {
    _unassignKeeper(jobKey_, keeperId_);

    emit JobKeeperChanged(jobKey_, keeperId_, 0);
  }

  // Assumes another keeper will be assigned later within the same transaction
  function _unassignKeeper(bytes32 jobKey_, uint256 keeperId_) internal {
    keeperLocksByJob[keeperId_].remove(jobKey_);

    jobNextKeeperId[jobKey_] = 0;
    jobSlashingPossibleAfter[jobKey_] = 0;
    jobReservedSlasherId[jobKey_] = 0;
  }

  function _ensureCanReleaseKeeper(uint256 keeperId_) internal view {
    uint256 len = keeperLocksByJob[keeperId_].length();
    if (len > 0) {
      revert KeeperIsAssignedToJobs(len);
    }
  }

  function _getPseudoRandom() internal view returns (uint256) {
    return block.difficulty;
  }

  function _releaseKeeperIfRequired(bytes32 jobKey_, uint256 keeperId_) internal returns (bool released) {
    uint256 binJob = getJobRaw(jobKey_);
    return _releaseKeeperIfRequiredBinJob(jobKey_, keeperId_, binJob, false);
  }

  function _releaseKeeperIfRequiredBinJob(
    bytes32 jobKey_,
    uint256 keeperId_,
    uint256 binJob_,
    bool checkAlreadyReleased
  ) internal returns (bool released) {
    if ((!checkAlreadyReleased || jobNextKeeperId[jobKey_] != 0) && !_shouldAssignKeeperBin(jobKey_, binJob_)) {
      _releaseKeeper(jobKey_, keeperId_);
      return true;
    }

    return false;
  }

  function _assignNextKeeperIfRequiredAndUpdateLastExecutedAt(
    bytes32 jobKey_,
    uint256 currentKeeperId_
  ) internal returns (bool assigned) {
    assigned = _assignNextKeeperIfRequired(jobKey_, currentKeeperId_);
    if (assigned) {
      uint256 binJob = getJobRaw(jobKey_);
      uint256 intervalSeconds = (binJob << 32) >> 232;
      if (intervalSeconds > 0) {
        uint256 lastExecutionAt = uint32(block.timestamp);
        binJob = binJob & BM_CLEAR_LAST_UPDATE_AT | (lastExecutionAt << 224);
        _updateRawJob(jobKey_, binJob);
      }
    }
  }

  function _assignNextKeeperIfRequired(bytes32 jobKey_, uint256 currentKeeperId_) internal returns (bool assigned) {
    if (currentKeeperId_ == 0 && shouldAssignKeeper(jobKey_)) {
      _assignNextKeeper(jobKey_, currentKeeperId_);
      return true;
    }
    return false;
  }

  function shouldAssignKeeper(bytes32 jobKey_) public view returns (bool) {
    return _shouldAssignKeeperBin(jobKey_, getJobRaw(jobKey_));
  }

  function _shouldAssignKeeperBin(bytes32 jobKey_, uint256 binJob_) internal view returns (bool) {
    uint256 credits;

    if (ConfigFlags.check(binJob_, CFG_USE_JOB_OWNER_CREDITS)) {
      credits = jobOwnerCredits[jobOwners[jobKey_]];
    } else {
      credits = (binJob_ << 128) >> 168;
    }

    if (credits >= (uint256(rdConfig.jobMinCreditsFinney) * 0.001 ether)) {
      return true;
    }

    return false;
  }

  function _assignNextKeeper(bytes32 jobKey_, uint256 previousKeeperId_) internal {
    uint256 pseudoRandom = _getPseudoRandom();
    uint256 totalActiveKeepers = activeKeepers.length();
    uint256 _jobMinKeeperCvp = jobMinKeeperCvp[jobKey_];
    uint256 index;
    unchecked {
      index = ((pseudoRandom + uint256(jobKey_)) % totalActiveKeepers);
    }

    while (true) {
      if (index  >= totalActiveKeepers) {
        index = 0;
      }
      uint256 _nextExecutionKeeperId = activeKeepers.at(index);

      uint256 requiredStake = _jobMinKeeperCvp > 0 ? _jobMinKeeperCvp : minKeeperCvp;
      Keeper memory keeper = keepers[_nextExecutionKeeperId];

      if (keeper.isActive && keeper.cvpStake >= requiredStake) {
        jobNextKeeperId[jobKey_] = _nextExecutionKeeperId;

        keeperLocksByJob[_nextExecutionKeeperId].add(jobKey_);
        emit JobKeeperChanged(jobKey_, previousKeeperId_, _nextExecutionKeeperId);
        return;
      }
      index += 1;
    }
  }

  function _checkBaseFee(uint256 binJob_, uint256 cfg_) internal pure override returns (uint256) {
    binJob_;
    cfg_;

    return type(uint256).max;
  }

  function _calculateCompensation(
    bool ok_,
    uint256 job_,
    uint256 keeperId_,
    uint256 gasPrice_,
    uint256 gasUsed_
  ) internal view override returns (uint256) {
    if (!ok_) {
      return gasUsed_ * gasPrice_;
    }

    job_; // silence unused param warning
    RandaoConfig memory _rdConfig = rdConfig;

    uint256 stake = keepers[keeperId_].cvpStake;
    // fixedReward field for randao jobs contains _jobMaxCvpStake
    uint256 _jobMaxCvpStake = ((job_ << 64) >> 224) * 1 ether;
    if (_jobMaxCvpStake > 0  && _jobMaxCvpStake < stake) {
      stake = _jobMaxCvpStake;
    }
    if (_rdConfig.agentMaxCvpStake > 0 && _rdConfig.agentMaxCvpStake < stake) {
      stake = _rdConfig.agentMaxCvpStake;
    }

    return (gasPrice_ * gasUsed_ * _rdConfig.jobCompensationMultiplierBps / 10_000) +
      (stake / _rdConfig.stakeDivisor);
  }

  /*** GETTERS ***/

  function getJobsAssignedToKeeper(uint256 keeperId_) external view returns (bytes32[] memory jobKeys) {
    return keeperLocksByJob[keeperId_].values();
  }

  function getJobsAssignedToKeeperLength(uint256 keeperId_) external view returns (uint256) {
    return keeperLocksByJob[keeperId_].length();
  }

  function getCurrentSlasherId(bytes32 jobKey_) public view returns (uint256) {
    return getSlasherIdByBlock(block.number, jobKey_);
  }

  function getActiveKeepersLength() external view returns (uint256) {
    return activeKeepers.length();
  }

  function getActiveKeepers() external view returns (uint256[] memory) {
    return activeKeepers.values();
  }

  function getRdConfig() external view returns (RandaoConfig memory) {
    return rdConfig;
  }

  function getSlasherIdByBlock(uint256 blockNumber_, bytes32 jobKey_) public view returns (uint256) {
    uint256 totalActiveKeepers = activeKeepers.length();
    uint256 index = ((blockNumber_ / rdConfig.slashingEpochBlocks + uint256(jobKey_)) % totalActiveKeepers);
    return activeKeepers.at(index);
  }

  // The function that always reverts
  function checkCouldBeExecuted(address jobAddress_, bytes memory jobCalldata_) external {
    (bool ok, bytes memory result) = jobAddress_.call(jobCalldata_);
    if (ok) {
      revert JobCheckCanBeExecuted();
    } else {
      revert JobCheckCanNotBeExecuted(result);
    }
  }
}

File 2 of 10 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 3 of 10 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.1) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.2;

import "../../utils/Address.sol";

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
 * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
 * case an upgrade adds a module that needs to be initialized.
 *
 * For example:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * contract MyToken is ERC20Upgradeable {
 *     function initialize() initializer public {
 *         __ERC20_init("MyToken", "MTK");
 *     }
 * }
 * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
 *     function initializeV2() reinitializer(2) public {
 *         __ERC20Permit_init("MyToken");
 *     }
 * }
 * ```
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 *
 * [CAUTION]
 * ====
 * Avoid leaving a contract uninitialized.
 *
 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
 * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
 * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() {
 *     _disableInitializers();
 * }
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     * @custom:oz-retyped-from bool
     */
    uint8 private _initialized;

    /**
     * @dev Indicates that the contract is in the process of being initialized.
     */
    bool private _initializing;

    /**
     * @dev Triggered when the contract has been initialized or reinitialized.
     */
    event Initialized(uint8 version);

    /**
     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
     * `onlyInitializing` functions can be used to initialize parent contracts.
     *
     * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a
     * constructor.
     *
     * Emits an {Initialized} event.
     */
    modifier initializer() {
        bool isTopLevelCall = !_initializing;
        require(
            (isTopLevelCall && _initialized < 1) || (!Address.isContract(address(this)) && _initialized == 1),
            "Initializable: contract is already initialized"
        );
        _initialized = 1;
        if (isTopLevelCall) {
            _initializing = true;
        }
        _;
        if (isTopLevelCall) {
            _initializing = false;
            emit Initialized(1);
        }
    }

    /**
     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
     * used to initialize parent contracts.
     *
     * A reinitializer may be used after the original initialization step. This is essential to configure modules that
     * are added through upgrades and that require initialization.
     *
     * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
     * cannot be nested. If one is invoked in the context of another, execution will revert.
     *
     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
     * a contract, executing them in the right order is up to the developer or operator.
     *
     * WARNING: setting the version to 255 will prevent any future reinitialization.
     *
     * Emits an {Initialized} event.
     */
    modifier reinitializer(uint8 version) {
        require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
        _initialized = version;
        _initializing = true;
        _;
        _initializing = false;
        emit Initialized(version);
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} and {reinitializer} modifiers, directly or indirectly.
     */
    modifier onlyInitializing() {
        require(_initializing, "Initializable: contract is not initializing");
        _;
    }

    /**
     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called
     * through proxies.
     *
     * Emits an {Initialized} event the first time it is successfully executed.
     */
    function _disableInitializers() internal virtual {
        require(!_initializing, "Initializable: contract is initializing");
        if (_initialized < type(uint8).max) {
            _initialized = type(uint8).max;
            emit Initialized(type(uint8).max);
        }
    }

    /**
     * @dev Returns the highest version that has been initialized. See {reinitializer}.
     */
    function _getInitializedVersion() internal view returns (uint8) {
        return _initialized;
    }

    /**
     * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
     */
    function _isInitializing() internal view returns (bool) {
        return _initializing;
    }
}

File 4 of 10 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);

    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `from` to `to` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) external returns (bool);
}

File 5 of 10 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check isContract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) private pure {
        // Look for revert reason and bubble it up if present
        if (returndata.length > 0) {
            // The easiest way to bubble the revert reason is using memory via assembly
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert(errorMessage);
        }
    }
}

File 6 of 10 : Context.sol
// 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;
    }
}

File 7 of 10 : EnumerableSet.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.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.
 *
 * ```
 * 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;
    }
}

File 8 of 10 : PPAgentV2.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/proxy/utils/Initializable.sol";
import "./PPAgentV2Flags.sol";
import "./PPAgentV2Interfaces.sol";

library ConfigFlags {
  function check(uint256 cfg, uint256 flag) internal pure returns (bool) {
    return (cfg & flag) != 0;
  }
}

/**
 * @title PowerAgentLite
 * @author PowerPool
 */
contract PPAgentV2 is IPPAgentV2Executor, IPPAgentV2Viewer, IPPAgentV2JobOwner, PPAgentV2Flags, Initializable, Ownable {
  error OnlyOwner();
  error NonEOASender();
  error InsufficientKeeperStake();
  error InsufficientJobScopedKeeperStake();
  error KeeperWorkerNotAuthorized();
  error InsufficientJobCredits(uint256 actual, uint256 wanted);
  error InsufficientJobOwnerCredits(uint256 actual, uint256 wanted);
  error InactiveJob(bytes32 jobKey);
  error JobIdOverflow();
  error OnlyJobOwner();
  error JobWithoutOwner();
  error MissingJobAddress();
  error MissingMaxBaseFeeGwei();
  error NoFixedNorPremiumPctReward();
  error CreditsDepositOverflow();
  error StakeAmountOverflow();
  error CreditsWithdrawalUnderflow();
  error MissingDeposit();
  error IntervalNotReached(uint256 lastExecutedAt, uint256 interval, uint256 _now);
  error BaseFeeGtGasPrice(uint256 baseFee, uint256 jobMaxBaseFeeGwei);
  error InvalidCalldataSource();
  error MissingInputCalldata();
  error SelectorCheckFailed();
  error JobCallRevertedWithoutDetails();
  error InsufficientAmountToCoverSlashedStake(uint256 wanted, uint256 actual);
  error AmountGtStake(uint256 wanted, uint256 actualStake, uint256 actualSlashedStake);
  error WithdrawalTimoutNotReached();
  error NoPendingWithdrawal();
  error MissingAmount();
  error WithdrawAmountExceedsAvailable(uint256 wanted, uint256 actual);
  error JobShouldHaveInterval();
  error ResolverJobCantHaveInterval();
  error InvalidJobAddress();
  error InvalidKeeperId();
  error MissingResolverAddress();
  error NotSupportedByJobCalldataSource();
  error OnlyKeeperAdmin();
  error OnlyKeeperAdminOrJobOwner();
  error OnlyKeeperAdminOrWorker();
  error TimeoutTooBig();
  error FeeTooBig();
  error InsufficientAmount();
  error OnlyPendingOwner();
  error WorkerAlreadyAssigned();

  string public constant VERSION = "2.3.0";
  uint256 internal constant MAX_PENDING_WITHDRAWAL_TIMEOUT_SECONDS = 30 days;
  uint256 internal constant MAX_FEE_PPM = 5e4;
  uint256 internal constant FIXED_PAYMENT_MULTIPLIER = 1e15;

  enum CalldataSourceType {
    SELECTOR,
    PRE_DEFINED,
    RESOLVER
  }

  address public immutable CVP;

  event Execute(
    bytes32 indexed jobKey,
    address indexed job,
    uint256 indexed keeperId,
    uint256 gasUsed,
    uint256 baseFee,
    uint256 gasPrice,
    uint256 compensation,
    bytes32 binJobAfter
  );
  event WithdrawFees(address indexed to, uint256 amount);
  event Slash(uint256 indexed keeperId, address indexed to, uint256 currentAmount, uint256 pendingAmount);
  event RegisterAsKeeper(uint256 indexed keeperId, address indexed keeperAdmin, address indexed keeperWorker);
  event SetWorkerAddress(uint256 indexed keeperId, address indexed prev, address indexed worker);
  event Stake(uint256 indexed keeperId, uint256 amount, address staker);
  event InitiateRedeem(uint256 indexed keeperId, uint256 redeemAmount, uint256 stakeAmount, uint256 slashedStakeAmount);
  event FinalizeRedeem(uint256 indexed keeperId, address indexed beneficiary, uint256 amount);
  event WithdrawCompensation(uint256 indexed keeperId, address indexed to, uint256 amount);
  event DepositJobCredits(bytes32 indexed jobKey, address indexed depositor, uint256 amount, uint256 fee);
  event WithdrawJobCredits(bytes32 indexed jobKey, address indexed owner, address indexed to, uint256 amount);
  event DepositJobOwnerCredits(address indexed jobOwner, address indexed depositor, uint256 amount, uint256 fee);
  event WithdrawJobOwnerCredits(address indexed jobOwner, address indexed to, uint256 amount);
  event InitiateJobTransfer(bytes32 indexed jobKey, address indexed from, address indexed to);
  event AcceptJobTransfer(bytes32 indexed jobKey_, address indexed to_);
  event SetJobConfig(bytes32 indexed jobKey, bool isActive_, bool useJobOwnerCredits_, bool assertResolverSelector_);
  event SetJobResolver(bytes32 indexed jobKey, address resolverAddress, bytes resolverCalldata);
  event SetJobPreDefinedCalldata(bytes32 indexed jobKey, bytes preDefinedCalldata);
  event SetAgentParams(uint256 minKeeperCvp_, uint256 timeoutSeconds_, uint256 feePpm_);
  event RegisterJob(
    bytes32 indexed jobKey,
    address indexed jobAddress,
    uint256 indexed jobId,
    address owner,
    RegisterJobParams params
  );
  event JobUpdate(
    bytes32 indexed jobKey,
    uint256 maxBaseFeeGwei,
    uint256 rewardPct,
    uint256 fixedReward,
    uint256 jobMinCvp,
    uint256 intervalSeconds
  );

  struct Keeper {
    address worker;
    uint88 cvpStake;
    bool isActive;
  }

  struct ExecutionResponsesData {
    bytes resolverResponse;
    bytes executionResponse;
  }

  uint256 internal minKeeperCvp;
  uint256 internal pendingWithdrawalTimeoutSeconds;
  uint256 internal feeTotal;
  uint256 internal feePpm;
  uint256 internal lastKeeperId;

  // keccak256(jobAddress, id) => ethBalance
  mapping(bytes32 => Job) internal jobs;
  // keccak256(jobAddress, id) => customCalldata
  mapping(bytes32 => bytes) internal preDefinedCalldatas;
  // keccak256(jobAddress, id) => minKeeperCvpStake
  mapping(bytes32 => uint256) internal jobMinKeeperCvp;
  // keccak256(jobAddress, id) => owner
  mapping(bytes32 => address) internal jobOwners;
  // keccak256(jobAddress, id) => resolver(address,calldata)
  mapping(bytes32 => Resolver) internal resolvers;
  // keccak256(jobAddress, id) => pendingAddress
  mapping(bytes32 => address) internal jobPendingTransfers;

  // jobAddress => lastIdRegistered(actually uint24)
  mapping(address => uint256) public jobLastIds;

  // keeperId => (worker,CVP stake)
  mapping(uint256 => Keeper) internal keepers;
  // keeperId => admin
  mapping(uint256 => address) internal keeperAdmins;
  // keeperId => the slashed CVP amount
  mapping(uint256 => uint256) internal slashedStakeOf;
  // keeperId => native token compensation
  mapping(uint256 => uint256) internal compensations;

  // keeperId => pendingWithdrawalCVP amount
  mapping(uint256 => uint256) internal pendingWithdrawalAmounts;
  // keeperId => pendingWithdrawalEndsAt timestamp
  mapping(uint256 => uint256) internal pendingWithdrawalEndsAt;

  // owner => credits
  mapping(address => uint256) public jobOwnerCredits;

  // worker => keeperIs
  mapping(address => uint256) public workerKeeperIds;

  /*** PSEUDO-MODIFIERS ***/

  function _assertOnlyOwner() internal view {
    if (msg.sender != owner()) {
      revert OnlyOwner();
    }
  }

  function _assertOnlyJobOwner(bytes32 jobKey_) internal view {
    if (msg.sender != jobOwners[jobKey_]) {
      revert OnlyJobOwner();
    }
  }

  function _assertOnlyKeeperAdmin(uint256 keeperId_) internal view {
    if (msg.sender != keeperAdmins[keeperId_]) {
      revert OnlyKeeperAdmin();
    }
  }

  function _assertOnlyKeeperAdminOrWorker(uint256 keeperId_) internal view {
    if (msg.sender != keeperAdmins[keeperId_] && msg.sender != keepers[keeperId_].worker) {
      revert OnlyKeeperAdminOrWorker();
    }
  }

  function _assertKeeperIdExists(uint256 keeperId_) internal view {
    if (keeperId_ > lastKeeperId) {
      revert InvalidKeeperId();
    }
  }

  function _assertWorkerNotAssigned(address worker_) internal view {
    if (workerKeeperIds[worker_] != 0) {
      revert WorkerAlreadyAssigned();
    }
  }

  function _assertNonZeroAmount(uint256 amount_) internal pure {
    if (amount_ == 0) {
      revert MissingAmount();
    }
  }

  function _assertNonZeroValue() internal view {
    if (msg.value == 0) {
      revert MissingDeposit();
    }
  }

  function _assertJobCalldataSource(bytes32 jobKey_, CalldataSourceType source_) internal view {
    if (CalldataSourceType(jobs[jobKey_].calldataSource) != source_) {
      revert NotSupportedByJobCalldataSource();
    }
  }

  function _assertJobParams(uint256 maxBaseFeeGwei_, uint256 fixedReward_, uint256 rewardPct_) internal pure {
    if (maxBaseFeeGwei_ == 0) {
      revert MissingMaxBaseFeeGwei();
    }

    if (fixedReward_ == 0 && rewardPct_ == 0) {
      revert NoFixedNorPremiumPctReward();
    }
  }

  function _assertInterval(uint256 interval_, CalldataSourceType calldataSource_) internal pure {
    if (interval_ == 0 &&
      (calldataSource_ == CalldataSourceType.SELECTOR || calldataSource_ == CalldataSourceType.PRE_DEFINED)) {
      revert JobShouldHaveInterval();
    }
    if (interval_ != 0 && calldataSource_ == CalldataSourceType.RESOLVER) {
      revert ResolverJobCantHaveInterval();
    }
  }

  constructor(address cvp_) {
    CVP = cvp_;
  }

  function initialize(
    address owner_,
    uint256 minKeeperCvp_,
    uint256 pendingWithdrawalTimeoutSeconds_
  ) public initializer {
    _setAgentParams(minKeeperCvp_, pendingWithdrawalTimeoutSeconds_, 0);
    _transferOwnership(owner_);
  }

  /*** HOOKS ***/
  function _beforeExecute(bytes32 jobKey_, uint256 actualKeeperId_, uint256 binJob_) internal view virtual {}
  function _beforeInitiateRedeem(uint256 keeperId_) internal view virtual {}

  function _afterExecutionSucceeded(bytes32 jobKey_, uint256 actualKeeperId_, uint256 binJob_) internal virtual {}
  function _afterRegisterJob(bytes32 jobKey_) internal virtual {}
  function _afterDepositJobCredits(bytes32 jobKey_) internal virtual {}
  function _afterWithdrawJobCredits(bytes32 jobKey_) internal virtual {}

  /*** CONSTANT GETTERS ***/
  function getStrategy() public pure virtual returns (string memory) {
    return "basic";
  }

  function _getJobGasOverhead() internal pure virtual returns (uint256) {
    return 40_000;
  }

  /*** UPKEEP INTERFACE ***/

  /**
   * Executes a job.
   * The method arguments a tightly coupled with a custom layout in order to save some gas.
   * The calldata has the following layout :
   *  0x      00000000 1b48315d66ba5267aac8d0ab63c49038b56b1dbc 0000f1 03     00001a    402b2eed11
   *  name    selector jobContractAddress                       jobId  config keeperId  calldata (optional)
   *  size b  bytes4   bytes20                                  uint24 uint8  uint24    any
   *  size u  uint32   uint160                                  bytes3 bytes1 bytes3    any
   *  bits    0-3      4-23                                     24-26  27-27  28-30     31+
   */
  function execute_44g58pv() external {
    uint256 gasStart = gasleft();
    bytes32 jobKey;

    assembly ("memory-safe") {
      // size of (address(bytes20)+id(uint24/bytes3))
      let size := 23

      // keccack256(address+id(uint24)) to memory to generate jobKey
      calldatacopy(0, 4, size)
      jobKey := keccak256(0, size)
    }

    address jobAddress;
    uint256 actualKeeperId;
    uint256 cfg;

    assembly ("memory-safe") {
      // load jobAddress, cfg, and keeperId from calldata to the stack
      jobAddress := shr(96, calldataload(4))
      cfg := shr(248, calldataload(27))
      actualKeeperId := shr(232, calldataload(28))
    }

    uint256 binJob = getJobRaw(jobKey);

    _beforeExecute(jobKey, actualKeeperId, binJob);

    // 0. Keeper has sufficient stake
    {
      Keeper memory keeper = keepers[actualKeeperId];
      if (keeper.worker != msg.sender) {
        revert KeeperWorkerNotAuthorized();
      }
      if (keeper.cvpStake < minKeeperCvp) {
        revert InsufficientKeeperStake();
      }
    }

    // 1. Assert the job is active
    {
      if (!ConfigFlags.check(binJob, CFG_ACTIVE)) {
        revert InactiveJob(jobKey);
      }
    }

    // 2. Assert job-scoped keeper's minimum CVP deposit
    if (ConfigFlags.check(binJob, CFG_CHECK_KEEPER_MIN_CVP_DEPOSIT) && keepers[actualKeeperId].cvpStake < jobMinKeeperCvp[jobKey]) {
      revert InsufficientJobScopedKeeperStake();
    }

    // 3. For interval job ensure the interval has passed
    {
      uint256 intervalSeconds = (binJob << 32) >> 232;

      if (intervalSeconds > 0) {
        uint256 lastExecutionAt = binJob >> 224;
        if (lastExecutionAt > 0) {
          uint256 nextExecutionAt;
          unchecked {
            nextExecutionAt = lastExecutionAt + intervalSeconds;
          }
          if (nextExecutionAt > block.timestamp) {
            revert IntervalNotReached(lastExecutionAt, intervalSeconds, block.timestamp);
          }
        }
      }
    }

    // 4. Ensure gas price fits base fee
    uint256 maxBaseFee = _checkBaseFee(binJob, cfg);

    // 5. Ensure msg.sender is EOA
    if (msg.sender != tx.origin) {
      revert NonEOASender();
    }

    bool ok;
    uint256 jobGas = gasleft() - 50_000;

    // Source: Selector
    CalldataSourceType calldataSource = CalldataSourceType((binJob << 56) >> 248);
    if (calldataSource == CalldataSourceType.SELECTOR) {
      bytes4 selector;
      assembly ("memory-safe") {
        selector := shl(224, shr(8, binJob))
      }
      (ok,) = jobAddress.call{ gas: jobGas }(abi.encode(selector));
    // Source: Bytes
    } else if (calldataSource == CalldataSourceType.PRE_DEFINED) {
      (ok,) = jobAddress.call{ gas: jobGas }(preDefinedCalldatas[jobKey]);
    // Source: Resolver
    } else if (calldataSource == CalldataSourceType.RESOLVER) {
      assembly ("memory-safe") {
        let cdInCdSize := calldatasize()
        // calldata offset is 31
        let beforeCdSize := 31
        let ptr := mload(0x40)
        if lt(cdInCdSize, beforeCdSize) {
          // revert MissingInputCalldata()
          mstore(ptr, 0x47a0bafb00000000000000000000000000000000000000000000000000000000)
          revert(ptr, 4)
        }
        let cdSize := sub(cdInCdSize, beforeCdSize)
        mstore(0x40, add(ptr, cdSize))
        calldatacopy(ptr, beforeCdSize, cdSize)
        // CFG_ASSERT_RESOLVER_SELECTOR = 0x04 from PPAgentLiteFlags
        if and(binJob, 0x04) {
          if iszero(eq(
            // actual
            shl(224, shr(224, calldataload(31))),
            // expected
            shl(224, shr(8, binJob))
          )) {
            // revert SelectorCheckFailed()
            mstore(ptr, 0x84fb827500000000000000000000000000000000000000000000000000000000)
            revert(ptr, 4)
          }
        }
        // The remaining gas could not be less than 50_000
        ok := call(jobGas, jobAddress, 0, ptr, cdSize, 0x0, 0x0)
      }
    } else {
      // Should never be reached
      revert InvalidCalldataSource();
    }

    // Load returned response only if the job call had failed
    bytes memory executionResponse;
    if (!ok) {
      assembly ("memory-safe") {
        let size := returndatasize()
        if gt(size, 0) {
          executionResponse := mload(0x40)
          mstore(executionResponse, size)
          let p := add(executionResponse, 0x20)
          returndatacopy(p, 0, size)
          mstore(0x40, add(executionResponse, add(32, size)))
        }
      }
    }

    // Payout block
    uint256 compensation;
    uint256 gasUsed;
    {
      binJob = getJobRaw(jobKey);
      unchecked {
        gasUsed = gasStart - gasleft();
      }

      {
        uint256 min = block.basefee;
        if (maxBaseFee < min) {
          min = maxBaseFee;
        }

        compensation = _calculateCompensation(ok, binJob, actualKeeperId, min, gasUsed);
      }
      {
        bool jobChanged;

        if (ConfigFlags.check(binJob, CFG_USE_JOB_OWNER_CREDITS)) {
          // use job owner credits
          _useJobOwnerCredits(ok, jobKey, compensation);
        } else {
          // use job credits
          uint256 creditsBefore = (binJob << 128) >> 168;
          if (creditsBefore < compensation) {
            if (ok) {
              revert InsufficientJobCredits(creditsBefore, compensation);
            } else {
              compensation = creditsBefore;
            }
          }

          uint256 creditsAfter;
          unchecked {
            creditsAfter = creditsBefore - compensation;
          }
          // update job credits
          binJob = binJob & BM_CLEAR_CREDITS | (creditsAfter << 40);
          jobChanged = true;
        }

        if (ConfigFlags.check(cfg, FLAG_ACCRUE_REWARD)) {
          compensations[actualKeeperId] += compensation;
        } else {
          payable(msg.sender).transfer(compensation);
        }

        // Update lastExecutionAt for interval jobs
        {
          uint256 intervalSeconds = (binJob << 32) >> 232;
          if (intervalSeconds > 0) {
            uint256 lastExecutionAt = uint32(block.timestamp);
            binJob = binJob & BM_CLEAR_LAST_UPDATE_AT | (lastExecutionAt << 224);
            jobChanged = true;
          }
        }

        if (jobChanged) {
          _updateRawJob(jobKey, binJob);
        }
      }
    }

    if (ok) {
      // Transaction succeeded
      emit Execute(
        jobKey,
        jobAddress,
        actualKeeperId,
        gasUsed,
        block.basefee,
        tx.gasprice,
        compensation,
        bytes32(binJob)
      );

      _afterExecutionSucceeded(jobKey, actualKeeperId, binJob);
    } else {
      // Tx reverted
      _afterExecutionReverted(jobKey, calldataSource, actualKeeperId, executionResponse);
    }
  }

  function _checkBaseFee(uint256 binJob_, uint256 cfg_) internal view virtual returns (uint256) {
    uint256 maxBaseFee;
    unchecked {
      maxBaseFee = ((binJob_ << 112) >> 240)  * 1 gwei;
    }
    if (block.basefee > maxBaseFee && !ConfigFlags.check(cfg_, FLAG_ACCEPT_MAX_BASE_FEE_LIMIT)) {
      revert BaseFeeGtGasPrice(block.basefee, maxBaseFee);
    }
    return maxBaseFee;
  }

  function _afterExecutionReverted(
    bytes32 jobKey_,
    CalldataSourceType calldataSource_,
    uint256 keeperId_,
    bytes memory executionResponse_
  ) internal virtual {
    jobKey_;
    keeperId_;
    calldataSource_;

    if (executionResponse_.length == 0) {
      revert JobCallRevertedWithoutDetails();
    } else {
      assembly ("memory-safe") {
        revert(add(32, executionResponse_), mload(executionResponse_))
      }
    }
  }

  function _calculateCompensation(
    bool ok_,
    uint256 job_,
    uint256 keeperId_,
    uint256 gasPrice_,
    uint256 gasUsed_
  ) internal view virtual returns (uint256) {
    ok_; // silence unused param warning
    keeperId_; // silence unused param warning
    uint256 fixedReward = (job_ << 64) >> 224;
    uint256 rewardPct = (job_ << 96) >> 240;
    return calculateCompensationPure(rewardPct, fixedReward, gasPrice_, gasUsed_);
  }

  function _useJobOwnerCredits(bool ok_, bytes32 jobKey_, uint256 compensation_) internal {
    uint256 jobOwnerCreditsBefore = jobOwnerCredits[jobOwners[jobKey_]];
    if (jobOwnerCreditsBefore < compensation_) {
      if (ok_) {
        revert InsufficientJobOwnerCredits(jobOwnerCreditsBefore, compensation_);
      } else {
        compensation_ = jobOwnerCreditsBefore;
      }
    }

    unchecked {
      jobOwnerCredits[jobOwners[jobKey_]] = jobOwnerCreditsBefore - compensation_;
    }
  }

  /*** JOB OWNER INTERFACE ***/

  /**
   * Registers a new job.
   *
   * Job id is unique counter for a given job address. Up to 2**24-1 jobs per address.
   * Job key is a keccak256(address, jobId).
   * The following options are immutable:
   *  - `params_.jobaddress`
   *  - `params_.calldataSource`
   * If you need to modify one of the immutable options above later consider creating a new job.
   *
   * @param params_ Job-specific params
   * @param resolver_ Resolver details(address, calldata), required only for CALLDATA_SOURCE_RESOLVER
   *                  job type. Use empty values for the other job types.
   * @param preDefinedCalldata_ Calldata to call a job with, required only for CALLDATA_SOURCE_PRE_DEFINED
   *              job type. Keep empty for the other job types.
   */
  function registerJob(
    RegisterJobParams calldata params_,
    Resolver calldata resolver_,
    bytes calldata preDefinedCalldata_
  ) external payable virtual returns (bytes32 jobKey, uint256 jobId){
    jobId = jobLastIds[params_.jobAddress] + 1;

    if (jobId > type(uint24).max) {
      revert JobIdOverflow();
    }

    if (msg.value > type(uint88).max) {
      revert CreditsDepositOverflow();
    }

    if (params_.jobAddress == address(0)) {
      revert MissingJobAddress();
    }

    if (params_.calldataSource > 2) {
      revert InvalidCalldataSource();
    }

    if (params_.jobAddress == address(CVP) || params_.jobAddress == address(this)) {
      revert InvalidJobAddress();
    }

    _assertInterval(params_.intervalSeconds, CalldataSourceType(params_.calldataSource));
    _assertJobParams(params_.maxBaseFeeGwei, params_.fixedReward, params_.rewardPct);
    jobKey = getJobKey(params_.jobAddress, jobId);

    emit RegisterJob(
      jobKey,
      params_.jobAddress,
      jobId,
      msg.sender,
      params_
    );

    if (CalldataSourceType(params_.calldataSource) == CalldataSourceType.PRE_DEFINED) {
      _setJobPreDefinedCalldata(jobKey, preDefinedCalldata_);
    } else if (CalldataSourceType(params_.calldataSource) == CalldataSourceType.RESOLVER) {
      _setJobResolver(jobKey, resolver_);
    }

    {
      bytes4 selector = 0x00000000;
      if (CalldataSourceType(params_.calldataSource) != CalldataSourceType.PRE_DEFINED) {
        selector = params_.jobSelector;
      }

      uint256 config = CFG_ACTIVE;
      if (params_.useJobOwnerCredits) {
        config = config | CFG_USE_JOB_OWNER_CREDITS;
      }
      if (params_.assertResolverSelector) {
        config = config | CFG_ASSERT_RESOLVER_SELECTOR;
      }
      if (params_.jobMinCvp > 0) {
        config = config | CFG_CHECK_KEEPER_MIN_CVP_DEPOSIT;
      }

      jobs[jobKey] = Job({
        config: uint8(config),
        selector: selector,
        credits: 0,
        maxBaseFeeGwei: params_.maxBaseFeeGwei,
        fixedReward: params_.fixedReward,
        rewardPct: params_.rewardPct,
        calldataSource: params_.calldataSource,

        // For interval jobs
        intervalSeconds: params_.intervalSeconds,
        lastExecutionAt: 0
      });
      jobMinKeeperCvp[jobKey] = params_.jobMinCvp;
    }

    jobLastIds[params_.jobAddress] = jobId;
    jobOwners[jobKey] = msg.sender;

    if (msg.value > 0) {
      if (params_.useJobOwnerCredits) {
        _processJobOwnerCreditsDeposit(msg.sender);
      } else {
        _processJobCreditsDeposit(jobKey);
      }
    }

    _afterRegisterJob(jobKey);
  }

  /**
   * Updates a job details.
   *
   * The following options are immutable:
   *  - `jobAddress`
   *  - `job.selector`
   *  - `job.calldataSource`
   * If you need to modify one of the immutable options above later consider creating a new job.
   *
   * @param jobKey_ The job key
   * @param maxBaseFeeGwei_ The maximum basefee in gwei to use for a job compensation
   * @param rewardPct_ The reward premium in pct, where 1 == 1%
   * @param fixedReward_ The fixed reward divided by FIXED_PAYMENT_MULTIPLIER
   * @param jobMinCvp_ The keeper minimal CVP stake to be eligible to execute this job
   * @param intervalSeconds_ The interval for a job execution
   */
  function updateJob(
    bytes32 jobKey_,
    uint16 maxBaseFeeGwei_,
    uint16 rewardPct_,
    uint32 fixedReward_,
    uint256 jobMinCvp_,
    uint24 intervalSeconds_
  ) external {
    _assertOnlyJobOwner(jobKey_);
    _assertJobParams(maxBaseFeeGwei_, fixedReward_, rewardPct_);

    Job memory job = jobs[jobKey_];

    _assertInterval(intervalSeconds_, CalldataSourceType(job.calldataSource));

    uint256 cfg = job.config;

    if (jobMinCvp_ > 0 && !ConfigFlags.check(job.config, CFG_CHECK_KEEPER_MIN_CVP_DEPOSIT)) {
      cfg = cfg | CFG_CHECK_KEEPER_MIN_CVP_DEPOSIT;
    }
    if (jobMinCvp_ == 0 && ConfigFlags.check(job.config, CFG_CHECK_KEEPER_MIN_CVP_DEPOSIT)) {
      cfg = cfg ^ CFG_CHECK_KEEPER_MIN_CVP_DEPOSIT;
    }

    jobs[jobKey_].config = uint8(cfg);
    jobMinKeeperCvp[jobKey_] = jobMinCvp_;

    jobs[jobKey_].maxBaseFeeGwei = maxBaseFeeGwei_;
    jobs[jobKey_].rewardPct = rewardPct_;
    jobs[jobKey_].fixedReward = fixedReward_;
    jobs[jobKey_].intervalSeconds = intervalSeconds_;

    emit JobUpdate(jobKey_, maxBaseFeeGwei_, rewardPct_, fixedReward_, jobMinCvp_, intervalSeconds_);
  }

  /**
   * A job owner updates job resolver details.
   *
   * @param jobKey_ The jobKey
   * @param resolver_ The new job resolver details
   */
  function setJobResolver(bytes32 jobKey_, Resolver calldata resolver_) external {
    _assertOnlyJobOwner(jobKey_);
    _assertJobCalldataSource(jobKey_, CalldataSourceType.RESOLVER);

    _setJobResolver(jobKey_, resolver_);
  }

  function _setJobResolver(bytes32 jobKey_, Resolver calldata resolver_) internal {
    if (resolver_.resolverAddress == address(0)) {
      revert MissingResolverAddress();
    }
    resolvers[jobKey_] = resolver_;
    emit SetJobResolver(jobKey_, resolver_.resolverAddress, resolver_.resolverCalldata);
  }

  /**
   * A job owner updates pre-defined calldata.
   *
   * @param jobKey_ The jobKey
   * @param preDefinedCalldata_ The new job pre-defined calldata
   */
  function setJobPreDefinedCalldata(bytes32 jobKey_, bytes calldata preDefinedCalldata_) external {
    _assertOnlyJobOwner(jobKey_);
    _assertJobCalldataSource(jobKey_, CalldataSourceType.PRE_DEFINED);

    _setJobPreDefinedCalldata(jobKey_, preDefinedCalldata_);
  }

  function _setJobPreDefinedCalldata(bytes32 jobKey_, bytes calldata preDefinedCalldata_) internal {
    preDefinedCalldatas[jobKey_] = preDefinedCalldata_;
    emit SetJobPreDefinedCalldata(jobKey_, preDefinedCalldata_);
  }

  /**
   * A job owner updates a job config flag.
   *
   * @param jobKey_ The jobKey
   * @param isActive_ Whether the job is active or not
   * @param useJobOwnerCredits_ The useJobOwnerCredits flag
   * @param assertResolverSelector_ The assertResolverSelector flag
   */
  function setJobConfig(
    bytes32 jobKey_,
    bool isActive_,
    bool useJobOwnerCredits_,
    bool assertResolverSelector_
  ) public virtual {
    _assertOnlyJobOwner(jobKey_);
    uint256 newConfig = 0;

    if (isActive_) {
      newConfig = newConfig | CFG_ACTIVE;
    }
    if (useJobOwnerCredits_) {
      newConfig = newConfig | CFG_USE_JOB_OWNER_CREDITS;
    }
    if (assertResolverSelector_) {
      newConfig = newConfig | CFG_ASSERT_RESOLVER_SELECTOR;
    }

    uint256 job = getJobRaw(jobKey_) & BM_CLEAR_CONFIG | newConfig;
    _updateRawJob(jobKey_, job);

    emit SetJobConfig(jobKey_, isActive_, useJobOwnerCredits_, assertResolverSelector_);
  }

  function _updateRawJob(bytes32 jobKey_, uint256 job_) internal {
    Job storage job = jobs[jobKey_];
    assembly ("memory-safe") {
      sstore(job.slot, job_)
    }
  }

  /**
   * A job owner initiates the job transfer to a new owner.
   * The actual owner doesn't update until the pending owner accepts the transfer.
   *
   * @param jobKey_ The jobKey
   * @param to_ The new job owner
   */
  function initiateJobTransfer(bytes32 jobKey_, address to_) external {
    _assertOnlyJobOwner(jobKey_);
    jobPendingTransfers[jobKey_] = to_;
    emit InitiateJobTransfer(jobKey_, msg.sender, to_);
  }

  /**
   * A pending job owner accepts the job transfer.
   *
   * @param jobKey_ The jobKey
   */
  function acceptJobTransfer(bytes32 jobKey_) external {
    if (msg.sender != jobPendingTransfers[jobKey_]) {
      revert OnlyPendingOwner();
    }

    jobOwners[jobKey_] = msg.sender;
    delete jobPendingTransfers[jobKey_];

    emit AcceptJobTransfer(jobKey_, msg.sender);
  }

  /**
   * Top-ups the job credits in NATIVE tokens.
   *
   * @param jobKey_ The jobKey to deposit for
   */
  function depositJobCredits(bytes32 jobKey_) external virtual payable {
    _assertNonZeroValue();

    if (jobOwners[jobKey_] == address(0)) {
      revert JobWithoutOwner();
    }

    _processJobCreditsDeposit(jobKey_);

    _afterDepositJobCredits(jobKey_);
  }

  function _processJobCreditsDeposit(bytes32 jobKey_) internal {
    (uint256 fee, uint256 amount) = _calculateDepositFee();
    uint256 creditsAfter = jobs[jobKey_].credits + amount;
    if (creditsAfter > type(uint88).max) {
      revert CreditsDepositOverflow();
    }

    unchecked {
      feeTotal += fee;
    }
    jobs[jobKey_].credits = uint88(creditsAfter);

    emit DepositJobCredits(jobKey_, msg.sender, amount, fee);
  }

  function _calculateDepositFee() internal view returns (uint256 fee, uint256 amount) {
    fee = msg.value * feePpm / 1e6 /* 100% in ppm */;
    amount = msg.value - fee;
  }

  /**
   * A job owner withdraws the job credits in NATIVE tokens.
   *
   * @param jobKey_ The jobKey
   * @param to_ The address to send NATIVE tokens to
   * @param amount_ The amount to withdraw. Use type(uint256).max for the total available credits withdrawal.
   */
  function withdrawJobCredits(
    bytes32 jobKey_,
    address payable to_,
    uint256 amount_
  ) external {
    uint88 creditsBefore = jobs[jobKey_].credits;
    if (amount_ == type(uint256).max) {
      amount_ = creditsBefore;
    }

    _assertOnlyJobOwner(jobKey_);
    _assertNonZeroAmount(amount_);

    if (creditsBefore < amount_) {
      revert CreditsWithdrawalUnderflow();
    }

    unchecked {
      jobs[jobKey_].credits = creditsBefore - uint88(amount_);
    }

    to_.transfer(amount_);

    emit WithdrawJobCredits(jobKey_, msg.sender, to_, amount_);

    _afterWithdrawJobCredits(jobKey_);
  }

  /**
   * Top-ups the job owner credits in NATIVE tokens.
   *
   * @param for_ The job owner address to deposit for
   */
  function depositJobOwnerCredits(address for_) external payable {
    _assertNonZeroValue();

    _processJobOwnerCreditsDeposit(for_);
  }

  function _processJobOwnerCreditsDeposit(address for_) internal {
    (uint256 fee, uint256 amount) = _calculateDepositFee();

    unchecked {
      feeTotal += fee;
      jobOwnerCredits[for_] += amount;
    }

    emit DepositJobOwnerCredits(for_, msg.sender, amount, fee);
  }

  /**
   * A job owner withdraws the job owner credits in NATIVE tokens.
   *
   * @param to_ The address to send NATIVE tokens to
   * @param amount_ The amount to withdraw. Use type(uint256).max for the total available credits withdrawal.
   */
  function withdrawJobOwnerCredits(address payable to_, uint256 amount_) external {
    uint256 creditsBefore = jobOwnerCredits[msg.sender];
    if (amount_ == type(uint256).max) {
      amount_ = creditsBefore;
    }

    _assertNonZeroAmount(amount_);

    if (creditsBefore < amount_) {
      revert CreditsWithdrawalUnderflow();
    }

    unchecked {
      jobOwnerCredits[msg.sender] = creditsBefore - amount_;
    }

    to_.transfer(amount_);

    emit WithdrawJobOwnerCredits(msg.sender, to_, amount_);
  }

  /*** KEEPER INTERFACE ***/

  /**
   * Actor registers as a keeper.
   * One keeper address could have multiple keeper IDs. Requires at least `minKeepCvp` as an initial CVP deposit.
   *
   * @dev Overflow-safe only for CVP which total supply is less than type(uint96).max
   * @dev Maximum 2^24-1 keepers supported. There is no explicit check for overflow, but the keepers with ID >= 2^24
   *         won't be able to perform upkeep operations.
   *
   * @param worker_ The worker address
   * @param initialDepositAmount_ The initial CVP deposit. Should be no less than `minKeepCvp`
   * @return keeperId The registered keeper ID
   */
  function registerAsKeeper(address worker_, uint256 initialDepositAmount_) public virtual returns (uint256 keeperId) {
    _assertWorkerNotAssigned(worker_);

    if (initialDepositAmount_ < minKeeperCvp) {
      revert InsufficientAmount();
    }

    keeperId = ++lastKeeperId;
    keeperAdmins[keeperId] = msg.sender;
    keepers[keeperId] = Keeper(worker_, 0, true);
    workerKeeperIds[worker_] = keeperId;
    emit RegisterAsKeeper(keeperId, msg.sender, worker_);

    _stake(keeperId, initialDepositAmount_);
  }

  /**
   * A keeper updates a keeper worker address
   *
   * @param keeperId_ The keeper ID
   * @param worker_ The new worker address
   */
  function setWorkerAddress(uint256 keeperId_, address worker_) external {
    _assertOnlyKeeperAdmin(keeperId_);
    _assertWorkerNotAssigned(worker_);

    address prev = keepers[keeperId_].worker;
    delete workerKeeperIds[prev];
    workerKeeperIds[worker_] = keeperId_;
    keepers[keeperId_].worker = worker_;

    emit SetWorkerAddress(keeperId_, prev, worker_);
  }

  /**
   * A keeper withdraws NATIVE token rewards.
   *
   * @param keeperId_ The keeper ID
   * @param to_ The address to withdraw to
   * @param amount_ The amount to withdraw. Use type(uint256).max for the total available compensation withdrawal.
   */
  function withdrawCompensation(uint256 keeperId_, address payable to_, uint256 amount_) external {
    uint256 available = compensations[keeperId_];
    if (amount_ == type(uint256).max) {
      amount_ = available;
    }

    _assertNonZeroAmount(amount_);
    _assertOnlyKeeperAdminOrWorker(keeperId_);

    if (amount_ > available) {
      revert WithdrawAmountExceedsAvailable(amount_, available);
    }

    unchecked {
      compensations[keeperId_] = available - amount_;
    }

    to_.transfer(amount_);

    emit WithdrawCompensation(keeperId_, to_, amount_);
  }

  /**
   * Deposits CVP for the given keeper ID. The beneficiary receives a derivative erc20 token in exchange of CVP.
   *   Accounts the staking amount on the beneficiary's stakeOf balance.
   *
   * @param keeperId_ The keeper ID
   * @param amount_ The amount to stake
   */
  function stake(uint256 keeperId_, uint256 amount_) external {
    _assertNonZeroAmount(amount_);
    _assertKeeperIdExists(keeperId_);
    _stake(keeperId_, amount_);
  }

  function _stake(uint256 keeperId_, uint256 amount_) internal {
    uint256 amountAfter = keepers[keeperId_].cvpStake + amount_;
    if (amountAfter > type(uint88).max) {
      revert StakeAmountOverflow();
    }
    IERC20(CVP).transferFrom(msg.sender, address(this), amount_);
    keepers[keeperId_].cvpStake += uint88(amount_);

    emit Stake(keeperId_, amount_, msg.sender);
  }

  /**
   * A keeper initiates CVP withdrawal.
   * The given CVP amount needs to go through the cooldown stage. After the cooldown is complete this amount could be
   * withdrawn using `finalizeRedeem()` method.
   * The msg.sender burns the paCVP token in exchange of the corresponding CVP amount.
   * Accumulates the existing pending for withdrawal amounts and re-initiates cooldown period.
   * If there is any slashed amount for the msg.sender, it should be compensated within the first initiateRedeem transaction
   * by burning the equivalent amount of paCVP tokens. The remaining CVP tokens won't be redeemed unless the slashed
   * amount is compensated.
   *
   * @param keeperId_ The keeper ID
   * @param amount_ The amount to cooldown
   * @return pendingWithdrawalAfter The total pending for withdrawal amount
   */
  function initiateRedeem(uint256 keeperId_, uint256 amount_) external returns (uint256 pendingWithdrawalAfter) {
    _assertOnlyKeeperAdmin(keeperId_);
    _assertNonZeroAmount(amount_);
    _beforeInitiateRedeem(keeperId_);

    uint256 stakeOfBefore = keepers[keeperId_].cvpStake;
    uint256 slashedStakeOfBefore = slashedStakeOf[keeperId_];
    uint256 totalStakeBefore = stakeOfBefore + slashedStakeOfBefore;

    // Should burn at least the total slashed stake
    if (amount_ < slashedStakeOfBefore) {
      revert InsufficientAmountToCoverSlashedStake(amount_, slashedStakeOfBefore);
    }

    if (amount_ > totalStakeBefore) {
      revert AmountGtStake(amount_, stakeOfBefore, slashedStakeOfBefore);
    }

    slashedStakeOf[keeperId_] = 0;
    uint256 stakeOfToReduceAmount;
    unchecked {
      stakeOfToReduceAmount = amount_ - slashedStakeOfBefore;
      keepers[keeperId_].cvpStake = uint88(stakeOfBefore - stakeOfToReduceAmount);
      pendingWithdrawalAmounts[keeperId_] += stakeOfToReduceAmount;
    }

    pendingWithdrawalAfter = block.timestamp + pendingWithdrawalTimeoutSeconds;
    pendingWithdrawalEndsAt[keeperId_] = pendingWithdrawalAfter;

    emit InitiateRedeem(keeperId_, amount_, stakeOfToReduceAmount, slashedStakeOfBefore);
  }

  /**
   * A keeper finalizes CVP withdrawal and receives the staked CVP tokens.
   *
   * @param keeperId_ The keeper ID
   * @param to_ The address to transfer CVP to
   * @return redeemedCvp The redeemed CVP amount
   */
  function finalizeRedeem(uint256 keeperId_, address to_) external returns (uint256 redeemedCvp) {
    _assertOnlyKeeperAdmin(keeperId_);

    if (pendingWithdrawalEndsAt[keeperId_] > block.timestamp) {
      revert WithdrawalTimoutNotReached();
    }

    redeemedCvp = pendingWithdrawalAmounts[keeperId_];
    if (redeemedCvp == 0) {
      revert NoPendingWithdrawal();
    }

    pendingWithdrawalAmounts[keeperId_] = 0;
    IERC20(CVP).transfer(to_, redeemedCvp);

    emit FinalizeRedeem(keeperId_, to_, redeemedCvp);
  }

  /*** CONTRACT OWNER INTERFACE ***/
  /**
   * Slashes any keeper_ for an amount within keeper's deposit.
   * Penalises a keeper for malicious behaviour like sandwitching upkeep transactions.
   *
   * @param keeperId_ The keeper ID to slash
   * @param to_ The address to send the slashed CVP to
   * @param currentAmount_ The amount to slash from the current keeper.cvpStake balance
   * @param pendingAmount_ The amount to slash from the pendingWithdrawals balance
   */
  function slash(uint256 keeperId_, address to_, uint256 currentAmount_, uint256 pendingAmount_) external {
    _assertOnlyOwner();
    uint256 totalAmount = currentAmount_ + pendingAmount_;
    _assertNonZeroAmount(totalAmount);

    if (currentAmount_ > 0) {
      keepers[keeperId_].cvpStake -= uint88(currentAmount_);
      slashedStakeOf[keeperId_] += currentAmount_;
    }

    if (pendingAmount_ > 0) {
      pendingWithdrawalAmounts[keeperId_] -= pendingAmount_;
    }

    IERC20(CVP).transfer(to_, totalAmount);

    emit Slash(keeperId_, to_, currentAmount_, pendingAmount_);
  }

  /**
   * Owner withdraws all the accrued rewards in native tokens to the provided address.
   *
   * @param to_ The address to send rewards to
   */
  function withdrawFees(address payable to_) external {
    _assertOnlyOwner();

    uint256 amount = feeTotal;
    feeTotal = 0;

    to_.transfer(amount);

    emit WithdrawFees(to_, amount);
  }

  /**
   * Owner updates minKeeperCVP value
   *
   * @param minKeeperCvp_ The new minKeeperCVP value
   */
  function setAgentParams(
    uint256 minKeeperCvp_,
    uint256 timeoutSeconds_,
    uint256 feePpm_
  ) external {
    _assertOnlyOwner();
    _setAgentParams(minKeeperCvp_, timeoutSeconds_, feePpm_);
  }

  function _setAgentParams(
    uint256 minKeeperCvp_,
    uint256 timeoutSeconds_,
    uint256 feePpm_
  ) internal {
    if (timeoutSeconds_ > MAX_PENDING_WITHDRAWAL_TIMEOUT_SECONDS) {
      revert TimeoutTooBig();
    }
    if (feePpm_ > MAX_FEE_PPM) {
      revert FeeTooBig();
    }

    minKeeperCvp = minKeeperCvp_;
    pendingWithdrawalTimeoutSeconds = timeoutSeconds_;
    feePpm = feePpm_;

    emit SetAgentParams(minKeeperCvp_, timeoutSeconds_, feePpm_);
  }

  /*** GETTERS ***/

  /**
   * Pure method that calculates keeper compensation based on a dynamic and a fixed multipliers.
   * DANGER: could overflow when used externally
   *
   * @param rewardPct_ The fixed percent. uint16. 0 == 0%, 100 == 100%, 500 == 500%, max 56535 == 56535%
   * @param fixedReward_ The fixed reward. uint32. Always multiplied by 1e15 (FIXED_PAYMENT_MULTIPLIER).
   *                     For ex. 2 == 2e15, 1_000 = 1e18, max 4294967295 == 4_294_967.295e18
   * @param blockBaseFee_ The block.basefee value.
   * @param gasUsed_ The gas used in wei.
   *
   */
  function calculateCompensationPure(
    uint256 rewardPct_,
    uint256 fixedReward_,
    uint256 blockBaseFee_,
    uint256 gasUsed_
  ) public pure returns (uint256) {
    unchecked {
      return (gasUsed_ + _getJobGasOverhead()) * blockBaseFee_ * rewardPct_ / 100
             + fixedReward_ * FIXED_PAYMENT_MULTIPLIER;
    }
  }

  function getKeeperWorkerAndStake(uint256 keeperId_)
    external view returns (
      address worker,
      uint256 currentStake,
      bool isActive
    )
  {
    Keeper memory keeper = keepers[keeperId_];

    return (
      keeper.worker,
      keeper.cvpStake,
      keeper.isActive
    );
  }

  function getConfig()
    external view returns (
      uint256 minKeeperCvp_,
      uint256 pendingWithdrawalTimeoutSeconds_,
      uint256 feeTotal_,
      uint256 feePpm_,
      uint256 lastKeeperId_
    )
  {
    return (
      minKeeperCvp,
      pendingWithdrawalTimeoutSeconds,
      feeTotal,
      feePpm,
      lastKeeperId
    );
  }

  function getKeeper(uint256 keeperId_)
    external view returns (
      address admin,
      address worker,
      bool isActive,
      uint256 currentStake,
      uint256 slashedStake,
      uint256 compensation,
      uint256 pendingWithdrawalAmount,
      uint256 pendingWithdrawalEndAt
    )
  {
    pendingWithdrawalEndAt = pendingWithdrawalEndsAt[keeperId_];
    pendingWithdrawalAmount = pendingWithdrawalAmounts[keeperId_];
    compensation = compensations[keeperId_];
    slashedStake = slashedStakeOf[keeperId_];

    Keeper memory keeper = keepers[keeperId_];
    currentStake = keeper.cvpStake;
    isActive = keeper.isActive;
    worker = keeper.worker;

    admin = keeperAdmins[keeperId_];
  }

  function getJob(bytes32 jobKey_)
    external view returns (
      address owner,
      address pendingTransfer,
      uint256 jobLevelMinKeeperCvp,
      Job memory details,
      bytes memory preDefinedCalldata,
      Resolver memory resolver
    )
  {
    return (
      jobOwners[jobKey_],
      jobPendingTransfers[jobKey_],
      jobMinKeeperCvp[jobKey_],
      jobs[jobKey_],
      preDefinedCalldatas[jobKey_],
      resolvers[jobKey_]
    );
  }

  /**
   * Returns the principal job data stored in a single EVM slot.
   * @notice To get parsed job data use `getJob()` method instead.
   *
   * The job slot data layout:
   *  0x0000000000000a000000000a002300640000000de0b6b3a7640000d09de08a01
   *  0x      00000000   00000a   00             0000000a    0023      0064           0000000de0b6b3a7640000 d09de08a 01
   *  name    lastExecAt interval calldataSource fixedReward rewardPct maxBaseFeeGwei nativeCredits          selector config bitmask
   *  size b  bytes4     bytes3   bytes4         bytes4      bytes2    bytes2         bytes11                bytes4   bytes1
   *  size u  uint32     uint24   uint8          uint32      uint16    uint16         uint88                 uint32   uint8
   *  bits    0-3        4-6      7-7            8-11        12-13     14-15          16-26                  27-30    31-31
   */
  function getJobRaw(bytes32 jobKey_) public view returns (uint256 rawJob) {
    Job storage job = jobs[jobKey_];
    assembly ("memory-safe") {
      rawJob := sload(job.slot)
    }
  }

  function getJobKey(address jobAddress_, uint256 jobId_) public pure returns (bytes32 jobKey) {
    assembly ("memory-safe") {
      mstore(0, shl(96, jobAddress_))
      mstore(20, shl(232, jobId_))
      jobKey := keccak256(0, 23)
    }
  }
}

File 9 of 10 : PPAgentV2Flags.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

contract PPAgentV2Flags {
  // Keeper pass this flags withing execute() transaction
  uint256 internal constant FLAG_ACCEPT_MAX_BASE_FEE_LIMIT = 0x01;
  uint256 internal constant FLAG_ACCRUE_REWARD = 0x02;

  // Job owner uses CFG_* flags to configure a job options
  uint256 internal constant CFG_ACTIVE = 0x01;
  uint256 internal constant CFG_USE_JOB_OWNER_CREDITS = 0x02;
  uint256 internal constant CFG_ASSERT_RESOLVER_SELECTOR = 0x04;
  uint256 internal constant CFG_CHECK_KEEPER_MIN_CVP_DEPOSIT = 0x08;

  uint256 internal constant BM_CLEAR_CONFIG = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00;
  uint256 internal constant BM_CLEAR_CREDITS = 0xffffffffffffffffffffffffffffffff0000000000000000000000ffffffffff;
  uint256 internal constant BM_CLEAR_LAST_UPDATE_AT = 0x00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff;
}

File 10 of 10 : PPAgentV2Interfaces.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

interface IPPAgentV2Executor {
  function execute_44g58pv() external;
}

interface IPPAgentV2Viewer {
  struct Job {
    uint8 config;
    bytes4 selector;
    uint88 credits;
    uint16 maxBaseFeeGwei;
    uint16 rewardPct;
    uint32 fixedReward;
    uint8 calldataSource;

    // For interval jobs
    uint24 intervalSeconds;
    uint32 lastExecutionAt;
  }

  struct Resolver {
    address resolverAddress;
    bytes resolverCalldata;
  }

  function getConfig() external view returns (
    uint256 minKeeperCvp_,
    uint256 pendingWithdrawalTimeoutSeconds_,
    uint256 feeTotal_,
    uint256 feePpm_,
    uint256 lastKeeperId_
  );
  function getKeeper(uint256 keeperId_) external view returns (
    address admin,
    address worker,
    bool isActive,
    uint256 currentStake,
    uint256 slashedStake,
    uint256 compensation,
    uint256 pendingWithdrawalAmount,
    uint256 pendingWithdrawalEndAt
  );
  function getKeeperWorkerAndStake(uint256 keeperId_) external view returns (
    address worker,
    uint256 currentStake,
    bool isActive
  );
  function getJob(bytes32 jobKey_) external view returns (
    address owner,
    address pendingTransfer,
    uint256 jobLevelMinKeeperCvp,
    Job memory details,
    bytes memory preDefinedCalldata,
    Resolver memory resolver
  );
  function getJobRaw(bytes32 jobKey_) external view returns (uint256 rawJob);
  function jobOwnerCredits(address owner_) external view returns (uint256 credits);
  function getStrategy() external pure returns (string memory);
  function CVP() external view returns (address);
}

interface IPPAgentV2JobOwner {
  struct RegisterJobParams {
    address jobAddress;
    bytes4 jobSelector;
    bool useJobOwnerCredits;
    bool assertResolverSelector;
    uint16 maxBaseFeeGwei;
    uint16 rewardPct;
    uint32 fixedReward;
    uint256 jobMinCvp;
    uint8 calldataSource;
    uint24 intervalSeconds;
  }
}

interface IPPAgentV2RandaoViewer {
  // 8+24+16+24+16+16+40+16+32 = 192
  struct RandaoConfig {
    // max: 2^8 - 1 = 255 blocks
    uint8 slashingEpochBlocks;
    // max: 2^24 - 1 = 16777215 seconds ~ 194 days
    uint24 period1;
    // max: 2^16 - 1 = 65535 seconds ~ 18 hours
    uint16 period2;
    // in 1 CVP. max: 16_777_215 CVP. The value here is multiplied by 1e18 in calculations.
    uint24 slashingFeeFixedCVP;
    // In BPS
    uint16 slashingFeeBps;
    // max: 2^16 - 1 = 65535, in calculations is multiplied by 0.001 ether (1 finney),
    // thus the min is 0.001 ether and max is 65.535 ether
    uint16 jobMinCreditsFinney;
    // max 2^40 ~= 1.1e12, in calculations is multiplied by 1 ether
    uint40 agentMaxCvpStake;
    // max: 2^16 - 1 = 65535, where 10_000 is 100%
    uint16 jobCompensationMultiplierBps;
    // max: 2^32 - 1 = 4_294_967_295
    uint32 stakeDivisor;
    // max: 2^8 - 1 = 255 hours, or ~10.5 days
    uint8 keeperActivationTimeoutHours;
  }

  function getRdConfig() external view returns (RandaoConfig memory);
  function getJobsAssignedToKeeper(uint256 keeperId_) external view returns (bytes32[] memory jobKeys);
  function getJobsAssignedToKeeperLength(uint256 keeperId_) external view returns (uint256);
  function getCurrentSlasherId(bytes32 jobKey_) external view returns (uint256);
  function getActiveKeepersLength() external view returns (uint256);
  function getActiveKeepers() external view returns (uint256[] memory);
  function getSlasherIdByBlock(uint256 blockNumber_, bytes32 jobKey_) external view returns (uint256);

  function jobNextKeeperId(bytes32 jobKey_) external view returns (uint256);
  function jobReservedSlasherId(bytes32 jobKey_) external view returns (uint256);
  function jobSlashingPossibleAfter(bytes32 jobKey_) external view returns (uint256);
  function jobCreatedAt(bytes32 jobKey_) external view returns (uint256);
  function keeperActivationCanBeFinalizedAt(uint256 keeperId_) external view returns (uint256);
}

Settings
{
  "viaIR": true,
  "optimizer": {
    "enabled": true,
    "runs": 1500
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "metadata": {
    "useLiteralContent": true
  },
  "libraries": {}
}

Contract ABI

[{"inputs":[{"internalType":"address","name":"cvp_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"uint256","name":"wanted","type":"uint256"},{"internalType":"uint256","name":"actualStake","type":"uint256"},{"internalType":"uint256","name":"actualSlashedStake","type":"uint256"}],"name":"AmountGtStake","type":"error"},{"inputs":[{"internalType":"uint256","name":"baseFee","type":"uint256"},{"internalType":"uint256","name":"jobMaxBaseFeeGwei","type":"uint256"}],"name":"BaseFeeGtGasPrice","type":"error"},{"inputs":[],"name":"CantAssignKeeper","type":"error"},{"inputs":[],"name":"CantRelease","type":"error"},{"inputs":[],"name":"CreditsDepositOverflow","type":"error"},{"inputs":[],"name":"CreditsWithdrawalUnderflow","type":"error"},{"inputs":[],"name":"FeeTooBig","type":"error"},{"inputs":[{"internalType":"bytes32","name":"jobKey","type":"bytes32"}],"name":"InactiveJob","type":"error"},{"inputs":[],"name":"InactiveKeeper","type":"error"},{"inputs":[],"name":"InitiateSlashingUnexpectedError","type":"error"},{"inputs":[],"name":"InsufficientAmount","type":"error"},{"inputs":[{"internalType":"uint256","name":"wanted","type":"uint256"},{"internalType":"uint256","name":"actual","type":"uint256"}],"name":"InsufficientAmountToCoverSlashedStake","type":"error"},{"inputs":[{"internalType":"uint256","name":"actual","type":"uint256"},{"internalType":"uint256","name":"wanted","type":"uint256"}],"name":"InsufficientJobCredits","type":"error"},{"inputs":[{"internalType":"uint256","name":"actual","type":"uint256"},{"internalType":"uint256","name":"wanted","type":"uint256"}],"name":"InsufficientJobOwnerCredits","type":"error"},{"inputs":[],"name":"InsufficientJobScopedKeeperStake","type":"error"},{"inputs":[],"name":"InsufficientKeeperStake","type":"error"},{"inputs":[{"internalType":"bytes32","name":"jobKey","type":"bytes32"},{"internalType":"uint256","name":"expectedKeeperId","type":"uint256"},{"internalType":"uint256","name":"keeperCurrentStake","type":"uint256"},{"internalType":"uint256","name":"amountToSlash","type":"uint256"}],"name":"InsufficientKeeperStakeToSlash","type":"error"},{"inputs":[{"internalType":"uint256","name":"lastExecutedAt","type":"uint256"},{"internalType":"uint256","name":"interval","type":"uint256"},{"internalType":"uint256","name":"_now","type":"uint256"}],"name":"IntervalNotReached","type":"error"},{"inputs":[],"name":"InvalidCalldataSource","type":"error"},{"inputs":[],"name":"InvalidJobAddress","type":"error"},{"inputs":[],"name":"InvalidKeeperId","type":"error"},{"inputs":[],"name":"InvalidPeriod1","type":"error"},{"inputs":[],"name":"InvalidPeriod2","type":"error"},{"inputs":[],"name":"InvalidSlashingFeeFixedCVP","type":"error"},{"inputs":[],"name":"InvalidStakeDivisor","type":"error"},{"inputs":[],"name":"JobCallRevertedWithoutDetails","type":"error"},{"inputs":[],"name":"JobCheckCanBeExecuted","type":"error"},{"inputs":[{"internalType":"bytes","name":"errReason","type":"bytes"}],"name":"JobCheckCanNotBeExecuted","type":"error"},{"inputs":[{"internalType":"bytes","name":"errReason","type":"bytes"}],"name":"JobCheckResolverError","type":"error"},{"inputs":[],"name":"JobCheckResolverReturnedFalse","type":"error"},{"inputs":[{"internalType":"uint256","name":"keeperId","type":"uint256"}],"name":"JobHasKeeperAssigned","type":"error"},{"inputs":[],"name":"JobIdOverflow","type":"error"},{"inputs":[],"name":"JobShouldHaveInterval","type":"error"},{"inputs":[],"name":"JobWithoutOwner","type":"error"},{"inputs":[],"name":"KeeperCantSlash","type":"error"},{"inputs":[],"name":"KeeperIsAlreadyActive","type":"error"},{"inputs":[],"name":"KeeperIsAlreadyInactive","type":"error"},{"inputs":[{"internalType":"uint256","name":"amountOfJobs","type":"uint256"}],"name":"KeeperIsAssignedToJobs","type":"error"},{"inputs":[],"name":"KeeperWorkerNotAuthorized","type":"error"},{"inputs":[],"name":"MissingAmount","type":"error"},{"inputs":[],"name":"MissingDeposit","type":"error"},{"inputs":[],"name":"MissingInputCalldata","type":"error"},{"inputs":[],"name":"MissingJobAddress","type":"error"},{"inputs":[],"name":"MissingMaxBaseFeeGwei","type":"error"},{"inputs":[],"name":"MissingResolverAddress","type":"error"},{"inputs":[],"name":"NoFixedNorPremiumPctReward","type":"error"},{"inputs":[],"name":"NoPendingWithdrawal","type":"error"},{"inputs":[],"name":"NonEOASender","type":"error"},{"inputs":[],"name":"NonIntervalJob","type":"error"},{"inputs":[],"name":"NotSupportedByJobCalldataSource","type":"error"},{"inputs":[{"internalType":"uint256","name":"expectedSlasherId","type":"uint256"}],"name":"OnlyCurrentSlasher","type":"error"},{"inputs":[],"name":"OnlyJobOwner","type":"error"},{"inputs":[],"name":"OnlyKeeperAdmin","type":"error"},{"inputs":[],"name":"OnlyKeeperAdminOrJobOwner","type":"error"},{"inputs":[],"name":"OnlyKeeperAdminOrWorker","type":"error"},{"inputs":[{"internalType":"uint256","name":"expectedKeeperId","type":"uint256"},{"internalType":"uint256","name":"lastExecutedAt","type":"uint256"},{"internalType":"uint256","name":"interval","type":"uint256"},{"internalType":"uint256","name":"slashingInterval","type":"uint256"},{"internalType":"uint256","name":"_now","type":"uint256"}],"name":"OnlyNextKeeper","type":"error"},{"inputs":[],"name":"OnlyOwner","type":"error"},{"inputs":[],"name":"OnlyPendingOwner","type":"error"},{"inputs":[{"internalType":"uint256","name":"reservedSlasherId","type":"uint256"}],"name":"OnlyReservedSlasher","type":"error"},{"inputs":[],"name":"ResolverJobCantHaveInterval","type":"error"},{"inputs":[],"name":"SelectorCheckFailed","type":"error"},{"inputs":[],"name":"SlashingBpsGt5000Bps","type":"error"},{"inputs":[],"name":"SlashingEpochBlocksTooLow","type":"error"},{"inputs":[],"name":"SlashingNotInitiated","type":"error"},{"inputs":[],"name":"SlashingNotInitiatedExecutionReverted","type":"error"},{"inputs":[],"name":"StakeAmountOverflow","type":"error"},{"inputs":[],"name":"TimeoutTooBig","type":"error"},{"inputs":[{"internalType":"uint256","name":"now","type":"uint256"},{"internalType":"uint256","name":"availableAt","type":"uint256"}],"name":"TooEarlyForActivationFinalization","type":"error"},{"inputs":[{"internalType":"uint256","name":"now_","type":"uint256"},{"internalType":"uint256","name":"possibleAfter","type":"uint256"}],"name":"TooEarlyForSlashing","type":"error"},{"inputs":[],"name":"TooEarlyToReinitiateSlashing","type":"error"},{"inputs":[{"internalType":"bytes32","name":"jobKey","type":"bytes32"},{"internalType":"uint256","name":"period2End","type":"uint256"}],"name":"TooEarlyToRelease","type":"error"},{"inputs":[],"name":"UnexpectedCodeBlock","type":"error"},{"inputs":[{"internalType":"uint256","name":"wanted","type":"uint256"},{"internalType":"uint256","name":"actual","type":"uint256"}],"name":"WithdrawAmountExceedsAvailable","type":"error"},{"inputs":[],"name":"WithdrawalTimoutNotReached","type":"error"},{"inputs":[],"name":"WorkerAlreadyAssigned","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"jobKey_","type":"bytes32"},{"indexed":true,"internalType":"address","name":"to_","type":"address"}],"name":"AcceptJobTransfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"jobKey","type":"bytes32"},{"indexed":true,"internalType":"address","name":"depositor","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"}],"name":"DepositJobCredits","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"jobOwner","type":"address"},{"indexed":true,"internalType":"address","name":"depositor","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"}],"name":"DepositJobOwnerCredits","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"keeperId","type":"uint256"}],"name":"DisableKeeper","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"jobKey","type":"bytes32"},{"indexed":true,"internalType":"address","name":"job","type":"address"},{"indexed":true,"internalType":"uint256","name":"keeperId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"gasUsed","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"baseFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"gasPrice","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"compensation","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"binJobAfter","type":"bytes32"}],"name":"Execute","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"jobKey","type":"bytes32"},{"indexed":true,"internalType":"uint256","name":"keeperId","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"executionReturndata","type":"bytes"}],"name":"ExecutionReverted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"keeperId","type":"uint256"}],"name":"FinalizeKeeperActivation","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"keeperId","type":"uint256"},{"indexed":true,"internalType":"address","name":"beneficiary","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"FinalizeRedeem","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"jobKey","type":"bytes32"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"InitiateJobTransfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"keeperId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"canBeFinalizedAt","type":"uint256"}],"name":"InitiateKeeperActivation","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"keeperId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"redeemAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"stakeAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"slashedStakeAmount","type":"uint256"}],"name":"InitiateRedeem","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"jobKey","type":"bytes32"},{"indexed":true,"internalType":"uint256","name":"slasherKeeperId","type":"uint256"},{"indexed":false,"internalType":"bool","name":"useResolver","type":"bool"},{"indexed":false,"internalType":"uint256","name":"jobSlashingPossibleAfter","type":"uint256"}],"name":"InitiateSlashing","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"jobKey","type":"bytes32"},{"indexed":true,"internalType":"uint256","name":"keeperFrom","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"keeperTo","type":"uint256"}],"name":"JobKeeperChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"jobKey","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"maxBaseFeeGwei","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"rewardPct","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"fixedReward","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"jobMinCvp","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"intervalSeconds","type":"uint256"}],"name":"JobUpdate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"keeperId","type":"uint256"},{"indexed":true,"internalType":"address","name":"keeperAdmin","type":"address"},{"indexed":true,"internalType":"address","name":"keeperWorker","type":"address"}],"name":"RegisterAsKeeper","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"jobKey","type":"bytes32"},{"indexed":true,"internalType":"address","name":"jobAddress","type":"address"},{"indexed":true,"internalType":"uint256","name":"jobId","type":"uint256"},{"indexed":false,"internalType":"address","name":"owner","type":"address"},{"components":[{"internalType":"address","name":"jobAddress","type":"address"},{"internalType":"bytes4","name":"jobSelector","type":"bytes4"},{"internalType":"bool","name":"useJobOwnerCredits","type":"bool"},{"internalType":"bool","name":"assertResolverSelector","type":"bool"},{"internalType":"uint16","name":"maxBaseFeeGwei","type":"uint16"},{"internalType":"uint16","name":"rewardPct","type":"uint16"},{"internalType":"uint32","name":"fixedReward","type":"uint32"},{"internalType":"uint256","name":"jobMinCvp","type":"uint256"},{"internalType":"uint8","name":"calldataSource","type":"uint8"},{"internalType":"uint24","name":"intervalSeconds","type":"uint24"}],"indexed":false,"internalType":"struct IPPAgentV2JobOwner.RegisterJobParams","name":"params","type":"tuple"}],"name":"RegisterJob","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"minKeeperCvp_","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timeoutSeconds_","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"feePpm_","type":"uint256"}],"name":"SetAgentParams","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"jobKey","type":"bytes32"},{"indexed":false,"internalType":"bool","name":"isActive_","type":"bool"},{"indexed":false,"internalType":"bool","name":"useJobOwnerCredits_","type":"bool"},{"indexed":false,"internalType":"bool","name":"assertResolverSelector_","type":"bool"}],"name":"SetJobConfig","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"jobKey","type":"bytes32"},{"indexed":false,"internalType":"bytes","name":"preDefinedCalldata","type":"bytes"}],"name":"SetJobPreDefinedCalldata","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"jobKey","type":"bytes32"},{"indexed":false,"internalType":"address","name":"resolverAddress","type":"address"},{"indexed":false,"internalType":"bytes","name":"resolverCalldata","type":"bytes"}],"name":"SetJobResolver","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"uint8","name":"slashingEpochBlocks","type":"uint8"},{"internalType":"uint24","name":"period1","type":"uint24"},{"internalType":"uint16","name":"period2","type":"uint16"},{"internalType":"uint24","name":"slashingFeeFixedCVP","type":"uint24"},{"internalType":"uint16","name":"slashingFeeBps","type":"uint16"},{"internalType":"uint16","name":"jobMinCreditsFinney","type":"uint16"},{"internalType":"uint40","name":"agentMaxCvpStake","type":"uint40"},{"internalType":"uint16","name":"jobCompensationMultiplierBps","type":"uint16"},{"internalType":"uint32","name":"stakeDivisor","type":"uint32"},{"internalType":"uint8","name":"keeperActivationTimeoutHours","type":"uint8"}],"indexed":false,"internalType":"struct IPPAgentV2RandaoViewer.RandaoConfig","name":"rdConfig","type":"tuple"}],"name":"SetRdConfig","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"keeperId","type":"uint256"},{"indexed":true,"internalType":"address","name":"prev","type":"address"},{"indexed":true,"internalType":"address","name":"worker","type":"address"}],"name":"SetWorkerAddress","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"keeperId","type":"uint256"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"currentAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"pendingAmount","type":"uint256"}],"name":"Slash","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"jobKey","type":"bytes32"},{"indexed":true,"internalType":"uint256","name":"expectedKeeperId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"actualKeeperId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"fixedSlashAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"dynamicSlashAmount","type":"uint256"}],"name":"SlashIntervalJob","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"keeperId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"staker","type":"address"}],"name":"Stake","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"keeperId","type":"uint256"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"WithdrawCompensation","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"WithdrawFees","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"jobKey","type":"bytes32"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"WithdrawJobCredits","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"jobOwner","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"WithdrawJobOwnerCredits","type":"event"},{"inputs":[],"name":"CVP","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"VERSION","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"jobKey_","type":"bytes32"}],"name":"acceptJobTransfer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"jobKeys_","type":"bytes32[]"}],"name":"assignKeeper","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"rewardPct_","type":"uint256"},{"internalType":"uint256","name":"fixedReward_","type":"uint256"},{"internalType":"uint256","name":"blockBaseFee_","type":"uint256"},{"internalType":"uint256","name":"gasUsed_","type":"uint256"}],"name":"calculateCompensationPure","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"jobAddress_","type":"address"},{"internalType":"bytes","name":"jobCalldata_","type":"bytes"}],"name":"checkCouldBeExecuted","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"jobKey_","type":"bytes32"}],"name":"depositJobCredits","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"for_","type":"address"}],"name":"depositJobOwnerCredits","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"keeperId_","type":"uint256"}],"name":"disableKeeper","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"execute_44g58pv","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"keeperId_","type":"uint256"}],"name":"finalizeKeeperActivation","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"keeperId_","type":"uint256"},{"internalType":"address","name":"to_","type":"address"}],"name":"finalizeRedeem","outputs":[{"internalType":"uint256","name":"redeemedCvp","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getActiveKeepers","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getActiveKeepersLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getConfig","outputs":[{"internalType":"uint256","name":"minKeeperCvp_","type":"uint256"},{"internalType":"uint256","name":"pendingWithdrawalTimeoutSeconds_","type":"uint256"},{"internalType":"uint256","name":"feeTotal_","type":"uint256"},{"internalType":"uint256","name":"feePpm_","type":"uint256"},{"internalType":"uint256","name":"lastKeeperId_","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"jobKey_","type":"bytes32"}],"name":"getCurrentSlasherId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"jobKey_","type":"bytes32"}],"name":"getJob","outputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"pendingTransfer","type":"address"},{"internalType":"uint256","name":"jobLevelMinKeeperCvp","type":"uint256"},{"components":[{"internalType":"uint8","name":"config","type":"uint8"},{"internalType":"bytes4","name":"selector","type":"bytes4"},{"internalType":"uint88","name":"credits","type":"uint88"},{"internalType":"uint16","name":"maxBaseFeeGwei","type":"uint16"},{"internalType":"uint16","name":"rewardPct","type":"uint16"},{"internalType":"uint32","name":"fixedReward","type":"uint32"},{"internalType":"uint8","name":"calldataSource","type":"uint8"},{"internalType":"uint24","name":"intervalSeconds","type":"uint24"},{"internalType":"uint32","name":"lastExecutionAt","type":"uint32"}],"internalType":"struct IPPAgentV2Viewer.Job","name":"details","type":"tuple"},{"internalType":"bytes","name":"preDefinedCalldata","type":"bytes"},{"components":[{"internalType":"address","name":"resolverAddress","type":"address"},{"internalType":"bytes","name":"resolverCalldata","type":"bytes"}],"internalType":"struct IPPAgentV2Viewer.Resolver","name":"resolver","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"jobAddress_","type":"address"},{"internalType":"uint256","name":"jobId_","type":"uint256"}],"name":"getJobKey","outputs":[{"internalType":"bytes32","name":"jobKey","type":"bytes32"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes32","name":"jobKey_","type":"bytes32"}],"name":"getJobRaw","outputs":[{"internalType":"uint256","name":"rawJob","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"keeperId_","type":"uint256"}],"name":"getJobsAssignedToKeeper","outputs":[{"internalType":"bytes32[]","name":"jobKeys","type":"bytes32[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"keeperId_","type":"uint256"}],"name":"getJobsAssignedToKeeperLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"keeperId_","type":"uint256"}],"name":"getKeeper","outputs":[{"internalType":"address","name":"admin","type":"address"},{"internalType":"address","name":"worker","type":"address"},{"internalType":"bool","name":"isActive","type":"bool"},{"internalType":"uint256","name":"currentStake","type":"uint256"},{"internalType":"uint256","name":"slashedStake","type":"uint256"},{"internalType":"uint256","name":"compensation","type":"uint256"},{"internalType":"uint256","name":"pendingWithdrawalAmount","type":"uint256"},{"internalType":"uint256","name":"pendingWithdrawalEndAt","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"keeperId_","type":"uint256"}],"name":"getKeeperWorkerAndStake","outputs":[{"internalType":"address","name":"worker","type":"address"},{"internalType":"uint256","name":"currentStake","type":"uint256"},{"internalType":"bool","name":"isActive","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRdConfig","outputs":[{"components":[{"internalType":"uint8","name":"slashingEpochBlocks","type":"uint8"},{"internalType":"uint24","name":"period1","type":"uint24"},{"internalType":"uint16","name":"period2","type":"uint16"},{"internalType":"uint24","name":"slashingFeeFixedCVP","type":"uint24"},{"internalType":"uint16","name":"slashingFeeBps","type":"uint16"},{"internalType":"uint16","name":"jobMinCreditsFinney","type":"uint16"},{"internalType":"uint40","name":"agentMaxCvpStake","type":"uint40"},{"internalType":"uint16","name":"jobCompensationMultiplierBps","type":"uint16"},{"internalType":"uint32","name":"stakeDivisor","type":"uint32"},{"internalType":"uint8","name":"keeperActivationTimeoutHours","type":"uint8"}],"internalType":"struct IPPAgentV2RandaoViewer.RandaoConfig","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"blockNumber_","type":"uint256"},{"internalType":"bytes32","name":"jobKey_","type":"bytes32"}],"name":"getSlasherIdByBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getStrategy","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"owner_","type":"address"},{"internalType":"uint256","name":"minKeeperCvp_","type":"uint256"},{"internalType":"uint256","name":"pendingWithdrawalTimeoutSeconds_","type":"uint256"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner_","type":"address"},{"internalType":"uint256","name":"minKeeperCvp_","type":"uint256"},{"internalType":"uint256","name":"pendingWithdrawalTimeoutSeconds_","type":"uint256"},{"components":[{"internalType":"uint8","name":"slashingEpochBlocks","type":"uint8"},{"internalType":"uint24","name":"period1","type":"uint24"},{"internalType":"uint16","name":"period2","type":"uint16"},{"internalType":"uint24","name":"slashingFeeFixedCVP","type":"uint24"},{"internalType":"uint16","name":"slashingFeeBps","type":"uint16"},{"internalType":"uint16","name":"jobMinCreditsFinney","type":"uint16"},{"internalType":"uint40","name":"agentMaxCvpStake","type":"uint40"},{"internalType":"uint16","name":"jobCompensationMultiplierBps","type":"uint16"},{"internalType":"uint32","name":"stakeDivisor","type":"uint32"},{"internalType":"uint8","name":"keeperActivationTimeoutHours","type":"uint8"}],"internalType":"struct IPPAgentV2RandaoViewer.RandaoConfig","name":"rdConfig_","type":"tuple"}],"name":"initializeRandao","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"jobKey_","type":"bytes32"},{"internalType":"address","name":"to_","type":"address"}],"name":"initiateJobTransfer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"keeperId_","type":"uint256"}],"name":"initiateKeeperActivation","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"keeperId_","type":"uint256"},{"internalType":"uint256","name":"amount_","type":"uint256"}],"name":"initiateRedeem","outputs":[{"internalType":"uint256","name":"pendingWithdrawalAfter","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"jobAddress_","type":"address"},{"internalType":"uint256","name":"jobId_","type":"uint256"},{"internalType":"uint256","name":"slasherKeeperId_","type":"uint256"},{"internalType":"bool","name":"useResolver_","type":"bool"},{"internalType":"bytes","name":"jobCalldata_","type":"bytes"}],"name":"initiateSlashing","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"jobCreatedAt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"jobLastIds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"jobNextKeeperId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"jobOwnerCredits","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"jobReservedSlasherId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"jobSlashingPossibleAfter","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"keeperActivationCanBeFinalizedAt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"worker_","type":"address"},{"internalType":"uint256","name":"initialDepositAmount_","type":"uint256"}],"name":"registerAsKeeper","outputs":[{"internalType":"uint256","name":"keeperId","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"jobAddress","type":"address"},{"internalType":"bytes4","name":"jobSelector","type":"bytes4"},{"internalType":"bool","name":"useJobOwnerCredits","type":"bool"},{"internalType":"bool","name":"assertResolverSelector","type":"bool"},{"internalType":"uint16","name":"maxBaseFeeGwei","type":"uint16"},{"internalType":"uint16","name":"rewardPct","type":"uint16"},{"internalType":"uint32","name":"fixedReward","type":"uint32"},{"internalType":"uint256","name":"jobMinCvp","type":"uint256"},{"internalType":"uint8","name":"calldataSource","type":"uint8"},{"internalType":"uint24","name":"intervalSeconds","type":"uint24"}],"internalType":"struct IPPAgentV2JobOwner.RegisterJobParams","name":"params_","type":"tuple"},{"components":[{"internalType":"address","name":"resolverAddress","type":"address"},{"internalType":"bytes","name":"resolverCalldata","type":"bytes"}],"internalType":"struct IPPAgentV2Viewer.Resolver","name":"resolver_","type":"tuple"},{"internalType":"bytes","name":"preDefinedCalldata_","type":"bytes"}],"name":"registerJob","outputs":[{"internalType":"bytes32","name":"jobKey","type":"bytes32"},{"internalType":"uint256","name":"jobId","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"jobKey_","type":"bytes32"}],"name":"releaseJob","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"minKeeperCvp_","type":"uint256"},{"internalType":"uint256","name":"timeoutSeconds_","type":"uint256"},{"internalType":"uint256","name":"feePpm_","type":"uint256"}],"name":"setAgentParams","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"jobKey_","type":"bytes32"},{"internalType":"bool","name":"isActive_","type":"bool"},{"internalType":"bool","name":"useJobOwnerCredits_","type":"bool"},{"internalType":"bool","name":"assertResolverSelector_","type":"bool"}],"name":"setJobConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"jobKey_","type":"bytes32"},{"internalType":"bytes","name":"preDefinedCalldata_","type":"bytes"}],"name":"setJobPreDefinedCalldata","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"jobKey_","type":"bytes32"},{"components":[{"internalType":"address","name":"resolverAddress","type":"address"},{"internalType":"bytes","name":"resolverCalldata","type":"bytes"}],"internalType":"struct IPPAgentV2Viewer.Resolver","name":"resolver_","type":"tuple"}],"name":"setJobResolver","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint8","name":"slashingEpochBlocks","type":"uint8"},{"internalType":"uint24","name":"period1","type":"uint24"},{"internalType":"uint16","name":"period2","type":"uint16"},{"internalType":"uint24","name":"slashingFeeFixedCVP","type":"uint24"},{"internalType":"uint16","name":"slashingFeeBps","type":"uint16"},{"internalType":"uint16","name":"jobMinCreditsFinney","type":"uint16"},{"internalType":"uint40","name":"agentMaxCvpStake","type":"uint40"},{"internalType":"uint16","name":"jobCompensationMultiplierBps","type":"uint16"},{"internalType":"uint32","name":"stakeDivisor","type":"uint32"},{"internalType":"uint8","name":"keeperActivationTimeoutHours","type":"uint8"}],"internalType":"struct IPPAgentV2RandaoViewer.RandaoConfig","name":"rdConfig_","type":"tuple"}],"name":"setRdConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"keeperId_","type":"uint256"},{"internalType":"address","name":"worker_","type":"address"}],"name":"setWorkerAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"jobKey_","type":"bytes32"}],"name":"shouldAssignKeeper","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"keeperId_","type":"uint256"},{"internalType":"address","name":"to_","type":"address"},{"internalType":"uint256","name":"currentAmount_","type":"uint256"},{"internalType":"uint256","name":"pendingAmount_","type":"uint256"}],"name":"slash","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"keeperId_","type":"uint256"},{"internalType":"uint256","name":"amount_","type":"uint256"}],"name":"stake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"jobKey_","type":"bytes32"},{"internalType":"uint16","name":"maxBaseFeeGwei_","type":"uint16"},{"internalType":"uint16","name":"rewardPct_","type":"uint16"},{"internalType":"uint32","name":"fixedReward_","type":"uint32"},{"internalType":"uint256","name":"jobMinCvp_","type":"uint256"},{"internalType":"uint24","name":"intervalSeconds_","type":"uint24"}],"name":"updateJob","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"keeperId_","type":"uint256"},{"internalType":"address payable","name":"to_","type":"address"},{"internalType":"uint256","name":"amount_","type":"uint256"}],"name":"withdrawCompensation","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"to_","type":"address"}],"name":"withdrawFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"jobKey_","type":"bytes32"},{"internalType":"address payable","name":"to_","type":"address"},{"internalType":"uint256","name":"amount_","type":"uint256"}],"name":"withdrawJobCredits","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"to_","type":"address"},{"internalType":"uint256","name":"amount_","type":"uint256"}],"name":"withdrawJobOwnerCredits","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"workerKeeperIds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]

Deployed Bytecode

0x6080604052600436101561001257600080fd5b60003560e01c801561374557806304d0fbdf1461357a578063071bbb1c1461355c57806307da0603146134fe5780630a8040ee146134d25780630c4a06d01461345257806310a6173f146133ac578063146cc168146132d0578063164e68de1461324b57806317381ff91461314e57806317d11280146131165780631c1ad03d146130dc578063289a582414612b06578063293ac1bf14612941578063298a16131461290757806329956b22146127b15780633268974c1461279557806336318a20146127695780633a1b9942146124eb5780634360a5821461243557806344d39361146123a557806346e891691461237957806348b00977146122ae578063499925561461210c5780634f6e394c14611fb857806350abdb5114611f99578063572d417b14611f255780636b5dd85514611d74578063715018a614611d005780637a1ac61e14611c305780637b0472f014611bdd5780637bdd1c7814611bbc57806386ffc0d614611b905780638da5cb5b14611b665780638f245cc514611ac55780639230f2c014611a8157806396cd3f6a14611a55578063981b61561461195c5780639a90808c1461186e5780639aae635c146118425780639af83df0146117bd5780639b907f2e146117865780639caec1d8146115885780639da867d5146114d15780639e7a1ae6146114a5578063a34f8e1414611373578063b07c4b5f146112b8578063b882eda614611294578063c148480714610b1e578063c3cd3b2b146108fd578063c3f909d4146108bd578063c44a7130146107f7578063d217a89514610703578063efcdd7aa14610641578063f2fde38b1461059c578063f729cf0d146103fa578063f83c1700146103bc578063f8f631881461034c578063fa713f40146103125763ffa1ad74146102ab57600080fd5b3461030d57600036600319011261030d576103096040516102cb8161433b565b600581527f322e332e30000000000000000000000000000000000000000000000000000000602082015260405191829160208352602083019061428c565b0390f35b600080fd5b3461030d57602036600319011261030d576001600160a01b0361033361423d565b1660005260136020526020604060002054604051908152f35b3461030d57602036600319011261030d57600435600052600d60205260606040600020604080519161037d836142cf565b546001600160a01b038116928381526001600160581b038260a01c169182602083015260f81c1515928391015260405192835260208301526040820152f35b3461030d57604036600319011261030d5760206103f26103da61423d565b6024359060601b60005260e81b601452601760002090565b604051908152f35b3461030d5760208060031936011261030d576040516104188161431e565b60008152600082820152600060408201526000606082015260006080820152600060a0820152600060c0820152600060e08201526000610100809201526060826040516104648161433b565b600081520152600435600052600982526103098260406001600160a01b0381838282600020541696600b82526105808484600020541691600884528460002054600685528560002091600786528660002091600a87526104d96104d36104cd8a6000209661472d565b946150d5565b9461517b565b9588519e8f9e8f9081520152878d015260ff82511660608d01526001600160e01b0319868301511660808d01526001600160581b03878301511660a08d015261ffff8c60c08260608601511691015260808301511660e08d015263ffffffff918c828460a0840151169101528c61012060ff60c0840151169101528c61014062ffffff60e0840151169101520151166101608b01526101c0806101808c01528a019061428c565b938885036101a08a01528151168452015193820152019061428c565b3461030d57602036600319011261030d576105b561423d565b6105bd614420565b6001600160a01b038116156105d7576105d59061447b565b005b608460405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152fd5b3461030d57602036600319011261030d5760043580600052600b6020526001600160a01b036040600020541633036106d957806000526009602052604060002073ffffffffffffffffffffffffffffffffffffffff19903382825416179055600b602052604060002090815416905533907f1f436fd25d350ec220955f7c1fadbae0d1e695cf8135a25ef9c0eab577223b9f600080a3005b60046040517ff0974640000000000000000000000000000000000000000000000000000000008152fd5b3461030d57604036600319011261030d5761071c61423d565b602435903360005260136020526040600020549060001983146107ee575b61074383614d34565b8282106107c457826001600160a01b03923360005260136020520360406000205516906000818381156107ba575b600092839283928392f1156107ae576040519081527f307ba9008c2eb2a77892b84866e728ce368061fe4e72e27221a4f63dfe50c08560203392a3005b6040513d6000823e3d90fd5b6108fc9250610771565b60046040517f3166cb3a000000000000000000000000000000000000000000000000000000008152fd5b9150809161073a565b3461030d5760208060031936011261030d576101009060043580600052601282526040600020549060118352604060002054906010845260406000205490600f855260406000205490600d8652604080600020815190610856826142cf565b54926001600160a01b0390818516928381526001600160581b038660a01c1695868c83015260f81c15159485910152600052600e8952604060002054169760405198895288015260408701526060860152608085015260a084015260c083015260e0820152f35b3461030d57600036600319011261030d5760a060015460025460035460045490600554926040519485526020850152604084015260608301526080820152f35b3461030d576101a036600319011261030d5761091761423d565b61014036606319011261030d5760405161093081614301565b60643560ff8116810361030d57815262ffffff608435818116810361030d57602083015261ffff9060a435828116810361030d57604084015260c435908116810361030d57606083015260e435818116810361030d57608083015261010435818116810361030d5760a08301526101243564ffffffffff8116810361030d5760c083015261014435908116810361030d5760e08201526101643563ffffffff8116810361030d576101008201526101843560ff8116810361030d5761012082015260005460ff8160081c161590818092610b11575b8015610afa575b15610a905760ff1981166001176000556105d593610a3e9183610a7e575b50610a39604435602435615083565b61447b565b156151a95761ff0019600054166000557f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498602060405160018152a16151a9565b61ffff19166101011760005585610a2a565b608460405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152fd5b50303b158015610a0c5750600160ff821614610a0c565b50600160ff821610610a05565b600319368101610180811261030d576101401361030d5767ffffffffffffffff9081610144351161030d57604090610144353603011261030d576101643590811161030d57610b719036906004016143f2565b6001600160a01b03610b8161457d565b16600052600c6020526040600020549160018301831161127e5762ffffff6001840111611254576001600160581b03341161122a576001600160a01b03610bc661457d565b161561120057600260ff610bd86145a7565b16116111d657610be661457d565b6001600160a01b03807f000000000000000000000000d5134ecd90eb63276af2fca897cc04d845afd74f1691161480156111bd575b61119357610c45610c2a6145b8565b62ffffff610c3e610c396145a7565b6145cb565b911661468f565b610c74610c506145da565b610c586145fc565b9061ffff63ffffffff81610c6a6145eb565b169316911661461e565b610c9760018401610c8361457d565b60601b60005260e81b601452601760002090565b91610ca061457d565b6040513381526001600160a01b03610cb661423d565b1660208201526001600160e01b031960243516806024350361030d576040820152610cdf6142c0565b15156060820152610cee6142b1565b1515608082015260843561ffff811680910361030d5760a082015260a43561ffff811680910361030d5760c082015260c43563ffffffff811680910361030d5760e082015260e4356101008201526101043560ff811680910361030d576101208201526101243562ffffff8116810361030d5762ffffff16610140820152847fb9b4668f2492830c54dc2fa7c8e28d9184882690fbedea4abeb03f016663d2126101606001600160a01b0360018a01951693a4610dac610c396145a7565b600381101561114b5760010361116157610dc69183614a82565b600091610dd4610c396145a7565b600381101561114b57600103611141575b600190610df061460f565b611138575b60643593841515850361030d5762ffffff600193610e699260409761112e575b60e435611123575b60ff9063ffffffff610e2d6145da565b61ffff610e386145fc565b9181610e426145eb565b916001600160e01b0319610e546145a7565b9789610e5e6145b8565b9b6040519e8f61431e565b168d521660208c015260008f8c01521660608a01521660808801521660a08601521660c08401521660e08201526000610100820152836000526006602052610100856000209160ff81511683549064ffffffff00602084015160d81c169164ffffffffff191617178355610f166001600160581b03888301511684906fffffffffffffffffffffff0000000000196fffffffffffffffffffffff000000000083549260281b169116179055565b6060810151835471ffff00000000000000000000000000000000191660809190911b71ffff0000000000000000000000000000000016178355608081015183547fffffffffffffffffffffffff0000ffffffffffffffffffffffffffffffffffff1660909190911b73ffff0000000000000000000000000000000000001617835560a08181015184547fffffffffffffffff00000000ffffffffffffffffffffffffffffffffffffffff16911b63ffffffff60a01b1617835560c081810151845460e08401517fffffffff00000000ffffffffffffffffffffffffffffffffffffffffffffffff9091169190921b78ff000000000000000000000000000000000000000000000000161760c89190911b7bffffff000000000000000000000000000000000000000000000000001617835501517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff6001600160e01b031983549260e01b169116179055600860205260e43584600020556001600160a01b0361109861457d565b16600052600c6020528181018460002055826000526009602052836000203373ffffffffffffffffffffffffffffffffffffffff19825416179055346110ff575b8260005260196020524284600020556110f183615aad565b508351928352016020820152f35b61110761460f565b1561111a5761111533614d65565b6110d9565b61111583614c37565b600890911790610e1d565b9060041790610e15565b60039150610df5565b6024359250610de5565b634e487b7160e01b600052602160045260246000fd5b505061116e610c396145a7565b600381101561114b57600203610dc65761118e6101443560040182614851565b610dc6565b60046040517f798943b6000000000000000000000000000000000000000000000000000000008152fd5b506111c661457d565b6001600160a01b03163014610c1b565b60046040517fe49b9c95000000000000000000000000000000000000000000000000000000008152fd5b60046040517f717833df000000000000000000000000000000000000000000000000000000008152fd5b60046040517f279f9e90000000000000000000000000000000000000000000000000000000008152fd5b60046040517f39655127000000000000000000000000000000000000000000000000000000008152fd5b634e487b7160e01b600052601160045260246000fd5b602036600319011261030d576105d56112ab61423d565b6112b3614c05565b614d65565b3461030d57602036600319011261030d576004356112d581614dda565b80600052600d60205260406000205460f81c61134957610e1060ff60155460c01c160261ffff811690810361127e5760206113317fe7c7353ea95538072de20aea628e98daa3974badf4938c7f66bd2f7896abf81d9242614570565b83600052601b825280604060002055604051908152a2005b60046040517f669ee629000000000000000000000000000000000000000000000000000000008152fd5b3461030d57606036600319011261030d5760043561138f614253565b90604435918160005260066020526001600160581b03908160406000205460281c16600019851461149d575b6113c4846147b4565b6113cd85614d34565b8481106107c4576001600160a01b0392611427918560005260066020528187169003166040600020906fffffffffffffffffffffff0000000000196fffffffffffffffffffffff000000000083549260281b169116179055565b16600083828115611493575b600092839283928392f1156107ae576105d592604051908152827f50ee63b3e6b23156354ac5126b37abf7adccada099df4c9c70205f887d76e8ca60203393a48060005260166020526040600020546006602052604060002054916159f7565b6108fc9250611433565b9350836113bb565b3461030d57602036600319011261030d5760043560005260186020526020604060002054604051908152f35b3461030d57604036600319011261030d576004356114ed614253565b6114f682614dda565b6114ff81614e23565b81600052600d6020526001600160a01b03806040600020541691826000526014602052600060408120551691826000528060406000205580600052600d60205260406000208373ffffffffffffffffffffffffffffffffffffffff198254161790557f803f1e6c69bc471f5a71c877bbb0b42287843a87118166f8b4a6701e75a9ae6a600080a4005b3461030d57608036600319011261030d576004356115a4614253565b9060443591611605606435916115b8615042565b6115c28386614570565b6115cb81614d34565b856116fd575b836116dd575b60405163a9059cbb60e01b81526001600160a01b038316600482015260248101919091529182906044820190565b03916020816001600160a01b0394816000877f000000000000000000000000d5134ecd90eb63276af2fca897cc04d845afd74f165af180156107ae5761167c575b50906040917fa0a4bc88df8261867a0171209f23c36f265d479f8d378e57eaddd804fa5a6d4c93835196875260208701521693a3005b91906020833d82116116d5575b8161169660209383614357565b8101031261030d577fa0a4bc88df8261867a0171209f23c36f265d479f8d378e57eaddd804fa5a6d4c936116cb604094614e6a565b5093509091611646565b3d9150611689565b84600052601160205260406000206116f68582546144f9565b90556115d7565b84600052600d60205261176660406000206117286001600160581b03808a1690835460a01c16615029565b7fff0000000000000000000000ffffffffffffffffffffffffffffffffffffffff6affffffffffffffffffffff60a01b83549260a01b169116179055565b84600052600f602052604060002061177f878254614570565b90556115d1565b3461030d57602036600319011261030d5760206117b3600435806000526006835260406000205490615b18565b6040519015158152f35b3461030d57604036600319011261030d576004356117d9614253565b906117e3816147b4565b80600052600b6020526001600160a01b0360406000209216918273ffffffffffffffffffffffffffffffffffffffff1982541617905533907f40b48a3ccb089339d160145168f44ff509c18d032508f53097f0dc6b829065a6600080a4005b3461030d57602036600319011261030d5760043560005260196020526020604060002054604051908152f35b3461030d5761014036600319011261030d57611888614420565b60405161189481614301565b60043560ff8116810361030d57815262ffffff602435818116810361030d57602083015261ffff90604435828116810361030d576040840152606435908116810361030d576060830152608435818116810361030d57608083015260a435818116810361030d5760a083015260c43564ffffffffff8116810361030d5760c083015260e435908116810361030d5760e08201526101043563ffffffff8116810361030d57610100820152610124359060ff8216820361030d576105d5916101208201526151a9565b3461030d57600036600319011261030d57600061012060405161197e81614301565b8281528260208201528260408201528260608201528260808201528260a08201528260c08201528260e08201528261010082015201526103096119bf615de0565b6040519182918291909161014081019260ff815116825262ffffff80602083015116602084015261ffff9081604084015116604085015260608301511660608401528060808301511660808401528060a08301511660a084015264ffffffffff60c08301511660c084015260e08201511660e083015261010063ffffffff81830151169083015260ff6101208092015116910152565b3461030d57602036600319011261030d5760043560005260176020526020604060002054604051908152f35b3461030d57600036600319011261030d5760206040516001600160a01b037f000000000000000000000000d5134ecd90eb63276af2fca897cc04d845afd74f168152f35b3461030d5760031960403682011261030d576004356024359167ffffffffffffffff831161030d57604090833603011261030d57611b02816147b4565b806000526006602052611b1f60ff60406000205460c01c166145cb565b600381101561114b57600203611b3c576105d59160040190614851565b60046040517fcaa30c5b000000000000000000000000000000000000000000000000000000008152fd5b3461030d57600036600319011261030d5760206001600160a01b0360005460101c16604051908152f35b3461030d57602036600319011261030d57600435600052601b6020526020604060002054604051908152f35b3461030d57604036600319011261030d5760206103f2602435600435615f57565b3461030d57611beb366143dc565b611bf481614d34565b6005548211611c06576105d591614e92565b60046040517f8bed2064000000000000000000000000000000000000000000000000000000008152fd5b3461030d57606036600319011261030d57611c4961423d565b60005460ff8160081c161591828093611cf3575b8015611cdc575b15610a905760ff198216600117600055611c8c9183611cca5750610a39604435602435615083565b611c9257005b61ff0019600054166000557f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498602060405160018152a1005b61ffff19166101011760005583610a2a565b50303b158015611c645750600160ff831614611c64565b50600160ff831610611c5d565b3461030d57600036600319011261030d57611d19614420565b60006001600160a01b0381547fffffffffffffffffffff0000000000000000000000000000000000000000ffff8116835560101c167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a3005b3461030d57608036600319011261030d5760043560243580159081159182820361030d57611da06142c0565b91847f654d2f54a1effa88d8b821bb9edce7ee03d265c6796c42b5fe8b7d5d55fa48c86060611dcd6142b1565b9683600052600660205260406000205496611de7856147b4565b6000898288611f1c575b611f12575b611f0a575b85600052600660205260ff19604060002054161760406000205560405191825215159788602083015215156040820152a260018316159384159384928760005260166020526040600020549680611f03575b611ef3575b83611eeb575b5082611edb575b5050611eae575b81611ea6575b50611e7357005b81611e8082600094615974565b7f9e86dacf7b4562091d7c1a5ea12bf39ac5cef2b9a6d6d357586c636d2f0cfa3b8380a4005b905083611e6c565b611eb88385615a44565b611e6657836000526006602052611ed560406000205484866159f7565b50611e66565b6002161515141590508580611e5f565b925087611e58565b611efd8789615a44565b50611e52565b5080611e4d565b600417611dfb565b9060021790611df6565b60019250611df1565b3461030d57604036600319011261030d5760043560243567ffffffffffffffff811161030d57611f599036906004016143f2565b90611f63836147b4565b826000526006602052611f8060ff60406000205460c01c166145cb565b600381101561114b57600103611b3c576105d592614a82565b3461030d57602036600319011261030d5760206103f260043543615f57565b3461030d5760208060031936011261030d5767ffffffffffffffff9060043582811161030d573660238201121561030d57806004013592831161030d57602490600590368386841b8301011161030d5760005b85811061201457005b8381841b830101358060005260168652604060002054806120dc5750612039816147b4565b61204281615aad565b9081612087575b501561205d57612058906154c1565b61200b565b60046040517f8f68909a000000000000000000000000000000000000000000000000000000008152fd5b6000526006865260406000205462ffffff8160c81c1615612049577bffffffffffffffffffffffffffffffffffffffffffffffffffffffff6001600160e01b03194260e01b1691161760406000205587612049565b8590604051907f4ec24d260000000000000000000000000000000000000000000000000000000082526004820152fd5b3461030d57604036600319011261030d57600435612128614253565b9061213281614dda565b8060005260209160128352604060002054421061228457816000526011835260406000205491821561225a5760008181526011855260408082208290555163a9059cbb60e01b81526001600160a01b03848116600483015260248201869052918690829060449082907f000000000000000000000000d5134ecd90eb63276af2fca897cc04d845afd74f87165af19081156107ae578691612203575b507f5e205b6e480b30b73f149f1e859cba98faf02d507680260f8626f19e640abdd291604051948686521693a3604051908152f35b9081813d8311612253575b6122188183614357565b8101031261030d577f5e205b6e480b30b73f149f1e859cba98faf02d507680260f8626f19e640abdd29161224c8792614e6a565b50916121ce565b503d61220e565b60046040517f9121b84f000000000000000000000000000000000000000000000000000000008152fd5b60046040517fd364d892000000000000000000000000000000000000000000000000000000008152fd5b3461030d57602036600319011261030d576004356122cb81614dda565b80600052600d60205260406000205460f81c1561234f576122eb816159b0565b6122f4816156b7565b5080600052600d60205260406000207effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81541690557f45641703db5524bed7c0c50d1f847831d91a699033b171b2721b23d9b89379b9600080a2005b60046040517ff911d015000000000000000000000000000000000000000000000000000000008152fd5b3461030d57602036600319011261030d5760043560005260066020526020604060002054604051908152f35b3461030d57604036600319011261030d576123be61423d565b60243567ffffffffffffffff811161030d576000916123e283923690600401614395565b9082602083519301915af16123f5614540565b901561240c5760046040516351abb75360e11b8152fd5b612431906040519182916319f6915960e31b835260206004840152602483019061428c565b0390fd5b3461030d57600036600319011261030d5760405180601c5480835260208093018091601c6000527f0e4562a10381dec21b205ed72637e6b1b523bdd0e4d4d50af5cd23dd4500a2119060005b868282106124d757868661249782880383614357565b604051928392818401908285525180915260408401929160005b8281106124c057505050500390f35b8351855286955093810193928101926001016124b1565b835485529093019260019283019201612481565b3461030d5760c036600319011261030d5760043561ffff60243581811680820361030d576044359283169182840361030d576064359263ffffffff841680850361030d576084359160a4359362ffffff85169485810361030d576126ce60a0986126917f36530212a24c816d4e494215a8c9e70aa89ee2c827cdaa6454c49a1b9c1f51709b612647612720968f61258d8a8f8d90612588856147b4565b61461e565b8060005260066020528c6125be6125a7604060002061472d565b916125b860ff60c0850151166145cb565b9061468f565b519060ff8216918d159081158061275e575b612754575b81612747575b5061273d575b600052600660205260ff6040600020911660ff1982541617905560086020528a604060002055600660205260406000209071ffff000000000000000000000000000000001971ffff0000000000000000000000000000000083549260801b169116179055565b6040600020907fffffffffffffffffffffffff0000ffffffffffffffffffffffffffffffffffff73ffff00000000000000000000000000000000000083549260901b169116179055565b6040600020907fffffffffffffffff00000000ffffffffffffffffffffffffffffffffffffffff63ffffffff60a01b83549260a01b169116179055565b6040600020907fffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffffff7bffffff0000000000000000000000000000000000000000000000000083549260c81b169116179055565b6040519485526020850152604084015260608301526080820152a2005b90600818906125e1565b60089150161515386125db565b92600817926125d5565b5060088116156125d0565b3461030d57602036600319011261030d5760043560005260166020526020604060002054604051908152f35b3461030d57602036600319011261030d576105d56004356154d0565b3461030d57606036600319011261030d576004356127cd614253565b600082815260106020526040902054604435929160001984146128fe575b6127f484614d34565b82600052600e6020526001600160a01b03918260406000205416331415806128e8575b6128be5780851161288757849084600052601060205203604060002055169160008184811561287d575b600092839283928392f1156107ae5760207f540b25d0ce24763795ee97abcbde8b65caecb84c08851dc1e31b5616deb86fb791604051908152a3005b6108fc9250612841565b84604491604051917fa209266700000000000000000000000000000000000000000000000000000000835260048301526024820152fd5b60046040517f3377c899000000000000000000000000000000000000000000000000000000008152fd5b50600d6020528260406000205416331415612817565b925080926127eb565b3461030d57602036600319011261030d576001600160a01b0361292861423d565b16600052600c6020526020604060002054604051908152f35b3461030d5761294f366143dc565b61295882614dda565b61296181614d34565b61296a826159b0565b81600052602091600d83526001600160581b03918260406000205460a01c1690600f85526040600020549361299f8584614570565b858310612acf578211612a875790612a317f2f344f62e88371893ede3b3ea3af1bbba704965ff1a7acc83ce2e367dcc4720d939285600052600f8852600060408120558683038094600d8a5203166040600020907fff0000000000000000000000ffffffffffffffffffffffffffffffffffffffff6affffffffffffffffffffff60a01b83549260a01b169116179055565b601186526040600020828154019055612a7c612a4f60025442614570565b95856000526012885286604060002055604051938493846040919493926060820195825260208201520152565b0390a2604051908152f35b50612431846040519384937fb3a6f108000000000000000000000000000000000000000000000000000000008552600485016040919493926060820195825260208201520152565b60448387604051917f85348f7c00000000000000000000000000000000000000000000000000000000835260048301526024820152fd5b3461030d5760a036600319011261030d57612b1f61423d565b60443590612b2b6142b1565b67ffffffffffffffff9160843583811161030d57612b4d903690600401614395565b91612b696024358360601b60005260e81b601452601760002090565b9384600052602093600685526040600020549387600052600d865260406000209160405192612b97846142cf565b54926001600160a01b03938481168083528983019060406001600160581b0394858560a01c168452019260f81c1515835233036130b257829051166001541161308857511561305e57600187161561304657600887161515908161301d575b50612ff35762ffffff809660c81c16612fc95787600052601687528860406000205414612f9f57612c278843615f57565b808a03612f6e575087600052601887526040600020548015159081612f52575b50612f28578415612dc757505060008091878252600a875286612c6c6040842061517b565b9182511691015190828883519301915af190612c86614540565b9115612d8a57815182019060408387840193031261030d57612ca9868401614e6a565b92604081015191821161030d570181603f8201121561030d578581015190612cd082614379565b92612cde6040519485614357565b8284526040838301011161030d57604087612cfb94019101614269565b15612d60577fb0b8fbafb0fc8d72dbac252687d8fdb1dc75b1dc89994eef74fd0d4e969ee0a692612d446040935b866000526017835287856000205560155460081c1642614570565b90856000526018815281846000205583519215158352820152a3005b60046040517f922bd83b000000000000000000000000000000000000000000000000000000008152fd5b50836124316040519283927f1c6917fa0000000000000000000000000000000000000000000000000000000084526004840152602483019061428c565b60009350612e2c8493612e1e60409b999b9a98979a519384928d8401967f44d3936100000000000000000000000000000000000000000000000000000000885216602484015260406044840152606483019061428c565b03601f198101835282614357565b519082305af193612e3b614540565b94612efe578451868601516001600160e01b03199181838093169160048110612ee8575b50509050166319f6915960e31b8114600014612e7c578551868801fd5b6351abb75360e11b919293955095939503612ebe577fb0b8fbafb0fc8d72dbac252687d8fdb1dc75b1dc89994eef74fd0d4e969ee0a692612d44604093612d29565b60046040517fc815d644000000000000000000000000000000000000000000000000000000008152fd5b8391925060040360031b1b161681908980612e5f565b60046040517fbc3ecf58000000000000000000000000000000000000000000000000000000008152fd5b60046040517f50eacfa8000000000000000000000000000000000000000000000000000000008152fd5b612f66915061ffff6015548a1c1690614570565b42108a612c47565b602490604051907faf6058030000000000000000000000000000000000000000000000000000000082526004820152fd5b60046040517f589ace18000000000000000000000000000000000000000000000000000000008152fd5b60046040517fc8ef7312000000000000000000000000000000000000000000000000000000008152fd5b60046040517f6bb33552000000000000000000000000000000000000000000000000000000008152fd5b905089600052600d885260406000205460a01c168860005260088852604060002054118a612bf6565b6024896040519063059a99e960e31b82526004820152fd5b60046040517f4fba0d77000000000000000000000000000000000000000000000000000000008152fd5b60046040517fa42f03de000000000000000000000000000000000000000000000000000000008152fd5b60046040517f4e2c6c26000000000000000000000000000000000000000000000000000000008152fd5b3461030d57602036600319011261030d576001600160a01b036130fd61423d565b1660005260146020526020604060002054604051908152f35b3461030d57608036600319011261030d57602060405166038d7ea4c6800060243502606460043560443561d6d8833501020204018152f35b3461030d57602036600319011261030d5760043561316b81614dda565b80600052601b602052604060002054428111613214575061318b816158aa565b5080600052600d60205260406000207f01000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff825416179055601b602052600060408120557f6f9aad08d1e095cdf28933bc980cde7cae350adab7abd43a6f45b4711f91554a600080a2005b604490604051907f8d639f7d0000000000000000000000000000000000000000000000000000000082524260048301526024820152fd5b3461030d57602036600319011261030d5761326461423d565b61326c615042565b6001600160a01b0360035491600060035516906000818381156132c6575b600092839283928392f1156107ae5760207f9bba815921f12cb7b1408e14b5ade745234397d39623ae5e7c82d693cb45815f91604051908152a2005b6108fc925061328a565b3461030d57606036600319011261030d576044356024356004356132f2615042565b62278d0082116133825761c3508311613358576133537f0c9773495c97952f53e7c7c23fc4ac36bc8d0e5c9ff4b5ffc8edd7b000931ea293826001558360025580600455604051938493846040919493926060820195825260208201520152565b0390a1005b60046040517ff6f3292b000000000000000000000000000000000000000000000000000000008152fd5b60046040517fde2180ee000000000000000000000000000000000000000000000000000000008152fd5b3461030d5760208060031936011261030d57600435600052601a8152604060002060405190818382549182815201908192600052846000209060005b8682821061343e5786866133fe82880383614357565b604051928392818401908285525180915260408401929160005b82811061342757505050500390f35b835185528695509381019392810192600101613418565b8354855290930192600192830192016133e8565b602036600319011261030d57600435613469614c05565b8060005260096020526001600160a01b0360406000205416156134a857806134936105d592614c37565b80600052601660205260406000205490615a44565b60046040517fa614bda7000000000000000000000000000000000000000000000000000000008152fd5b3461030d57602036600319011261030d57600435600052601a6020526020604060002054604051908152f35b3461030d57600036600319011261030d5761030960405161351e8161433b565b600681527f72616e64616f0000000000000000000000000000000000000000000000000000602082015260405191829160208352602083019061428c565b3461030d57600036600319011261030d576020601c54604051908152f35b3461030d57604036600319011261030d5761359361423d565b602435906135a081614e23565b600154821061371b576137096020926135ba6005546154c1565b928360055583600052600e855260406000209073ffffffffffffffffffffffffffffffffffffffff19913383825416179055604051906135f9826142cf565b61367d6001600160581b036001600160a01b038093169485855289850190600082526040860194600186528a600052600d8c52604060002096511690865416178555511683907fff0000000000000000000000ffffffffffffffffffffffffffffffffffffffff6affffffffffffffffffffff60a01b83549260a01b169116179055565b5115157effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7fff0000000000000000000000000000000000000000000000000000000000000083549260f81b16911617905580600052601485528360406000205533847f28e52185bb539dddafff5a07d4d7a65b6d44c6be0460f18b77ad1b5d7c7b6d7d600080a482614e92565b613712816158aa565b50604051908152f35b60046040517f5945ea56000000000000000000000000000000000000000000000000000000008152fd5b3461030d57600036600319011261030d575a60176004600037601760002090816000526006602052604060002054601660205260406000205462ffffff8260c81c169081159081159182809361422e575b156141395750828460e01c808015614124575b60155460081c62ffffff169201820142106140db575050506137cb8543615f57565b80601c3560e81c03612f6e57505b601c3560e81c600052600d6020526040600020604051906137f9826142cf565b54906001600160a01b03821690818152604060208201936001600160581b038160a01c16855260f81c151591015233036130b2576001600160581b03905116600154116130885760018316156140c3576008831615158061408d575b612ff357614034575b5032330361400a575a8061c34f1981011161127e5760ff8260c01c16906003821015928361114b5782613e8e576000918291826040516001600160e01b0319602082019360d81b168352602081526138b58161433b565b519260043560601c9061c34f1901f16138cc614540565b50905b6060908215613e63575b856000526006602052604060002054945a9003936138ff8548601c3560e81c8988615e6c565b9360006002881615613db257858960005260096020526001600160a01b03604060002054166000526013602052604060002054878110613d5b575b8a60005260096020526001600160a01b03604060002054166000526013602052036040600020555b601b3560f81c60021615613d2e57601c3560e81c6000526010602052604060002061398e878254614570565b90555b62ffffff8860c81c16613cf6575b613ce1575b15613bef575050506040519182524860208301523a60408301526060820152816080820152601c3560e81c90837f59200007defbdd8d2c9e53dd05f81091fe977b424f38f2562df9ee8725d5846960a060043560601c93a481600052601660205262ffffff6040600020549160c81c1615613bd2575b601c3560e81c8103613a57575b816000526006602052613a3f60406000205483615b18565b15611e735781613a52826105d594615974565b615cb9565b80600052600d602052604060002060405190613a72826142cf565b54906001600160a01b03821681526001600160581b038260a01c16906040602082019383855260f81c151591015262ffffff612710613abc6015549361ffff8560481c1690614d01565b049160301c1691670de0b6b3a76400009283810293818504149015171561127e576001600160581b0380613af08486614570565b16915116808211613b8f5750613b529084600052600d602052613b286040600020611728836001600160581b03835460a01c16615029565b601c3560e81c600052600d6020526117286040600020916001600160581b03835460a01c16614e77565b604051918252602082015281837f91ec4b3508c1fbba50acbe95e1593ee51d7cd728319d13f7dec9a4af0c3a06256040601c3560e81c94a4613a27565b608491869186604051937f0828a7df0000000000000000000000000000000000000000000000000000000085526004850152602484015260448301526064820152fd5b601760205260006040812055601860205260006040812055613a1a565b9250925093925061114b5760021480613ccb575b80613cb5575b613c8b57613c1c601c3560e81c82615974565b7f3454012bf26f21c2e3a04026973f2af1f97d8834ca552b580c20feb339eaf7f86040516000601c3560e81c847f9e86dacf7b4562091d7c1a5ea12bf39ac5cef2b9a6d6d357586c636d2f0cfa3b8380a46020815280613c86601c3560e81c95602083019061428c565b0390a3005b60046040517f9c3ae7fb000000000000000000000000000000000000000000000000000000008152fd5b5080600052601860205260406000205415613c09565b5080600052601760205260406000205415613c03565b876000526006602052866040600020556139a4565b50957bffffffffffffffffffffffffffffffffffffffffffffffffffffffff6001600160e01b03194260e01b1691161795600161399f565b8560008115613d52575b600080809381933390f1613991576040513d6000823e3d90fd5b506108fc613d38565b98969492909795939181600014613da35760448a8a604051917f5a27597b00000000000000000000000000000000000000000000000000000000835260048301526024820152fd5b9193959750919395978061393a565b5095846001600160581b038260281c1610613df7575b6fffffffffffffffffffffff000000000019856001600160581b038360281c160360281b911617956001613962565b9592909693949183600014613e4957604487876001600160581b03604051927f208118ad00000000000000000000000000000000000000000000000000000000845260281c1660048301526024820152fd5b919450919492956001600160581b038460281c1693613dc8565b3d80613e70575b506138d9565b91506020604051928084528060008386013e83010160405286613e6a565b6000935060018303613f485750846000526007602052604060002060405190600090805490613ebc82614506565b9160018116908115613f305750600114613efa575b5050918160008094938194039260043560601c9061c34f1901f1613ef3614540565b50906138cf565b90915060005260206000206000905b828210613f1c5750508101816000613ed1565b600181602092548487015201910190613f09565b60ff1916855250508015150282019050816000613ed1565b60009350600283036111d65760405190601f3610613fe257601e19908136840101604052813601601f843760048116613f9b575b50916000929183809336019260043560601c9061c34f1901f1906138cf565b6001600160e01b0319809160d81b1690601f351603613fba5787613f7c565b6004827f84fb8275000000000000000000000000000000000000000000000000000000008152fd5b6004827f47a0bafb000000000000000000000000000000000000000000000000000000008152fd5b60046040517fa397a6e5000000000000000000000000000000000000000000000000000000008152fd5b8160e01c9081614045575b5061385e565b42818301111561403f576040517fe096085e00000000000000000000000000000000000000000000000000000000815260048101929092526024820152426044820152606490fd5b50601c3560e81c600052600d6020526001600160581b0360406000205460a01c1685600052600860205260406000205411613855565b6024856040519063059a99e960e31b82526004820152fd5b60a493508490604051937f6a13aff50000000000000000000000000000000000000000000000000000000085526004850152602484015260448301526064820152426084820152fd5b508760005260196020526040600020546137a9565b908161421e575b50156137d957601860205260406000205480156141f45742106141af57846000526017602052604060002054601c3560e81c810361417e57506137d9565b602490604051907f94b5e7580000000000000000000000000000000000000000000000000000000082526004820152fd5b8460005260186020526044604060002054604051907fef49ea470000000000000000000000000000000000000000000000000000000082524260048301526024820152fd5b60046040517fbe32c0ad000000000000000000000000000000000000000000000000000000008152fd5b9050601c3560e81c141586614140565b50601c3560e81c821415613796565b600435906001600160a01b038216820361030d57565b602435906001600160a01b038216820361030d57565b60005b83811061427c5750506000910152565b818101518382015260200161426c565b906020916142a581518092818552858086019101614269565b601f01601f1916010190565b60643590811515820361030d57565b60443590811515820361030d57565b6060810190811067ffffffffffffffff8211176142eb57604052565b634e487b7160e01b600052604160045260246000fd5b610140810190811067ffffffffffffffff8211176142eb57604052565b610120810190811067ffffffffffffffff8211176142eb57604052565b6040810190811067ffffffffffffffff8211176142eb57604052565b90601f8019910116810190811067ffffffffffffffff8211176142eb57604052565b67ffffffffffffffff81116142eb57601f01601f191660200190565b81601f8201121561030d578035906143ac82614379565b926143ba6040519485614357565b8284526020838301011161030d57816000926020809301838601378301015290565b604090600319011261030d576004359060243590565b9181601f8401121561030d5782359167ffffffffffffffff831161030d576020838186019501011161030d57565b6001600160a01b0360005460101c16330361443757565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b6000549075ffffffffffffffffffffffffffffffffffffffff00008160101b167fffffffffffffffffffff0000000000000000000000000000000000000000ffff8316176000556001600160a01b038091169160101c167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3565b9190820391821161127e57565b90600182811c92168015614536575b602083101461452057565b634e487b7160e01b600052602260045260246000fd5b91607f1691614515565b3d1561456b573d9061455182614379565b9161455f6040519384614357565b82523d6000602084013e565b606090565b9190820180921161127e57565b6004356001600160a01b038116810361030d5790565b356001600160a01b038116810361030d5790565b6101043560ff8116810361030d5790565b6101243562ffffff8116810361030d5790565b60ff16600381101561114b5790565b60843561ffff8116810361030d5790565b60a43561ffff8116810361030d5790565b60c43563ffffffff8116810361030d5790565b604435801515810361030d5790565b156146655715908161465c575b5061463257565b60046040517f896ce9f7000000000000000000000000000000000000000000000000000000008152fd5b9050153861462b565b60046040517f2f61889e000000000000000000000000000000000000000000000000000000008152fd5b158080614712575b6146e8571590816146d4575b506146aa57565b60046040517f35608707000000000000000000000000000000000000000000000000000000008152fd5b9050600381101561114b57600214386146a3565b60046040517f732dc014000000000000000000000000000000000000000000000000000000008152fd5b50600382101561114b57811580614697575060018214614697565b9060405161473a8161431e565b61010081935460ff811683526001600160e01b03198160d81b1660208401526001600160581b038160281c16604084015261ffff808260801c1660608501528160901c16608084015263ffffffff8160a01c1660a084015260ff8160c01c1660c084015262ffffff8160c81c1660e084015260e01c910152565b60005260096020526001600160a01b036040600020541633036147d357565b60046040517fddf69e82000000000000000000000000000000000000000000000000000000008152fd5b903590601e198136030182121561030d570180359067ffffffffffffffff821161030d5760200191813603831361030d57565b908060209392818452848401376000828201840152601f01601f1916010190565b9190916001600160a01b038061486685614593565b1615614a5857600093828552602094600a865260408120908361488884614593565b1673ffffffffffffffffffffffffffffffffffffffff19835416178255600180920190878401926148b984866147fd565b929067ffffffffffffffff8411614a44576148d48554614506565b601f81116149fe575b5081601f851160011461496e579380806149469561495e99957f259cf3286fb257c644397539ce6a98f9c054f66d90577d69e02503a85a5e99ce9d9e9f999560409994614963575b50501b916000199060031b1c19161790555b61494086614593565b956147fd565b91909281519687961686528501526040840191614830565b0390a2565b013592503880614925565b91601f9493941984168684528c8420935b8181106149e957509361495e97937f259cf3286fb257c644397539ce6a98f9c054f66d90577d69e02503a85a5e99ce9b9c9d9793604097938361494698106149cf575b505050811b019055614937565b0135600019600384901b60f8161c191690553880806149c2565b83830135855593860193918d01918d0161497f565b8583528b8320601f860160051c8101918d8710614a3a575b601f0160051c019084905b828110614a2f5750506148dd565b848155018490614a21565b9091508190614a16565b602482634e487b7160e01b81526041600452fd5b60046040517fa7220e58000000000000000000000000000000000000000000000000000000008152fd5b919060009083825260209160078352604081209067ffffffffffffffff8511614bf157614aaf8254614506565b601f8111614bae575b5080601f8611600114614b265791857fd22231b382b21cb9521ddd32d9acb2f6ee7720c09de2cfba0fbadabd15932a949695949261495e9491614b1b575b508560011b906000198760031b1c19161790555b604051938385948552840191614830565b905082013538614af6565b90601f198616838352858320925b818110614b9757509161495e9391877fd22231b382b21cb9521ddd32d9acb2f6ee7720c09de2cfba0fbadabd15932a949897969410614b7d575b5050600185811b019055614b0a565b830135600019600388901b60f8161c191690553880614b6e565b919286600181928689013581550194019201614b34565b828252848220601f870160051c810191868810614be7575b601f0160051c01905b818110614bdc5750614ab8565b828155600101614bcf565b9091508190614bc6565b80634e487b7160e01b602492526041600452fd5b3415614c0d57565b60046040517f50e620e2000000000000000000000000000000000000000000000000000000008152fd5b620f4240614c4760045434614d01565b0490614c5382346144f9565b918160005260066020526001600160581b03614c79848260406000205460281c16614570565b9080821161122a57614cce918360035401600355846000526006602052166040600020906fffffffffffffffffffffff0000000000196fffffffffffffffffffffff000000000083549260281b169116179055565b60405192835260208301527fcde4bbac54ccbe285df37dd4861ba498967f700c80555187ce308b499d8980f860403393a3565b8181029291811591840414171561127e57565b8115614d1e570490565b634e487b7160e01b600052601260045260246000fd5b15614d3b57565b60046040517f06551f4d000000000000000000000000000000000000000000000000000000008152fd5b620f4240614d7560045434614d01565b046001600160a01b03614d8882346144f9565b9282600354016003551690816000526013602052604060002083815401905560405192835260208301527f37d2d0ab5d3d834b49345443201eb89ca4ac72dc66ca316e761fd1bb3d667d1d60403393a3565b600052600e6020526001600160a01b03604060002054163303614df957565b60046040517fd6b3e94e000000000000000000000000000000000000000000000000000000008152fd5b6001600160a01b03166000526014602052604060002054614e4057565b60046040517f81f9afb3000000000000000000000000000000000000000000000000000000008152fd5b5190811515820361030d57565b9190916001600160581b038080941691160191821161127e57565b919091600092818452602090600d82526001600160581b039160409280614ec18482878b205460a01c16614570565b116150005783517f23b872dd00000000000000000000000000000000000000000000000000000000815233600482015230602482015283604482015282816064818b6001600160a01b037f000000000000000000000000d5134ecd90eb63276af2fca897cc04d845afd74f165af18015614ff657614f8c575b50614f7f906117288589887fb1ab6be18e00655e8a052f6565edf39309c0038d15c0be04c4f2beadbb65f924999a9b52600d8652209180861690835460a01c16614e77565b82519182523390820152a2565b8281813d8311614fef575b614fa18183614357565b81010312614feb5790611728857fb1ab6be18e00655e8a052f6565edf39309c0038d15c0be04c4f2beadbb65f924979899614fde614f7f95614e6a565b5099989750505090614f3a565b8780fd5b503d614f97565b85513d8a823e3d90fd5b600484517f58fe7437000000000000000000000000000000000000000000000000000000008152fd5b6001600160581b03918216908216039190821161127e57565b6001600160a01b0360005460101c16330361505957565b60046040517f5fc483c5000000000000000000000000000000000000000000000000000000008152fd5b9062278d00811161338257816060917f0c9773495c97952f53e7c7c23fc4ac36bc8d0e5c9ff4b5ffc8edd7b000931ea293600155806002556000600455604051918252602082015260006040820152a1565b90604051918260008254926150e984614506565b9081845260019485811690816000146151585750600114615115575b505061511392500383614357565b565b9093915060005260209081600020936000915b81831061514057505061511393508201013880615105565b85548884018501529485019487945091830191615128565b91505061511394506020925060ff191682840152151560051b8201013880615105565b906040516151888161433b565b60206151a4600183956001600160a01b038154168552016150d5565b910152565b600360ff8251161061549757602081019062ffffff600f818451161061546d5760409081830161ffff91600f838351161061544457606085019081511660015460011c1061541b576113886080860193845116116153f25761010085019363ffffffff855116156153c95751806152aa878291909161014081019260ff815116825262ffffff80602083015116602084015261ffff9081604084015116604085015260608301511660608401528060808301511660808401528060a08301511660a084015264ffffffffff60c08301511660c084015260e08201511660e083015261010063ffffffff81830151169083015260ff6101208092015116910152565b037fcc1d108ed0036ac4b0509b3e98393d088b95269b2abd0c6c8cf0c3e2934ea0ab91a1845160ff1692601554965160081b63ffffff0016925160201b65ffff0000000016915160301b68ffffff00000000000016905160481b6affff000000000000000000169160a087015160581b6cffff0000000000000000000000169360c088015160681b71ffffffffff00000000000000000000000000169560e089015160901b73ffff00000000000000000000000000000000000016975160a01b63ffffffff60a01b1698610120015160c01b78ff00000000000000000000000000000000000000000000000016997fffffffffffffff000000000000000000000000000000000000000000000000001617171717171717171717601555565b600490517f23f2d4e8000000000000000000000000000000000000000000000000000000008152fd5b600484517fb46f0167000000000000000000000000000000000000000000000000000000008152fd5b600484517f49c84849000000000000000000000000000000000000000000000000000000008152fd5b600484517fe9d67fee000000000000000000000000000000000000000000000000000000008152fd5b60046040517f8a4c398e000000000000000000000000000000000000000000000000000000008152fd5b60046040517f22a1dbb5000000000000000000000000000000000000000000000000000000008152fd5b600019811461127e5760010190565b6000908082526020906016825260408084205492600981526001600160a01b03828620541633146156465761550484614dda565b828552600681528185205461551a8186866159f7565b61563e5762ffffff9060c881901c8216156155df5761555e929161ffff9160e01c80156155ce575b61555590601554928360081c1690614570565b921c1690614570565b904282116155995750505b6155738282615974565b7f9e86dacf7b4562091d7c1a5ea12bf39ac5cef2b9a6d6d357586c636d2f0cfa3b8380a4565b6044935051917f85c5653000000000000000000000000000000000000000000000000000000000835260048301526024820152fd5b508588526019835284882054615542565b505082855260188152818520549081156156155760155461560692911c61ffff1690614570565b90428211615599575050615569565b600483517f72ef2515000000000000000000000000000000000000000000000000000000008152fd5b505050505050565b50506155738282615974565b601c5481101561568957601c6000527f0e4562a10381dec21b205ed72637e6b1b523bdd0e4d4d50af5cd23dd4500a2110190600090565b634e487b7160e01b600052603260045260246000fd5b80548210156156895760005260206000200190600090565b6000818152601d602052604081205490919080156157b557600019908082018181116157a157601c549083820191821161578d57808203615740575b505050601c54801561572c5781019061570b82615652565b909182549160031b1b19169055601c558152601d6020526040812055600190565b602484634e487b7160e01b81526031600452fd5b61577761574f61575e93615652565b90549060031b1c928392615652565b819391549060031b600019811b9283911b169119161790565b90558452601d60205260408420553880806156f3565b602486634e487b7160e01b81526011600452fd5b602485634e487b7160e01b81526011600452fd5b505090565b906001820190600092818452826020526040842054908115156000146158a3576000199180830181811161588f5782549084820191821161587b57808203615846575b5050508054801561583257820191615815838361569f565b909182549160031b1b191690555582526020526040812055600190565b602486634e487b7160e01b81526031600452fd5b61586661585661575e938661569f565b90549060031b1c9283928661569f565b905586528460205260408620553880806157fd565b602488634e487b7160e01b81526011600452fd5b602487634e487b7160e01b81526011600452fd5b5050505090565b6000818152601d60205260408120546158fc57601c5468010000000000000000811015614a445790826158e861575e84600160409601601c55615652565b9055601c54928152601d6020522055600190565b905090565b9190600183016000908282528060205260408220541560001461596e578454946801000000000000000086101561595a578361594a61575e886001604098999a0185558461569f565b9055549382526020522055600190565b602483634e487b7160e01b81526041600452fd5b50925050565b6000918252601a60205261598b81604084206157ba565b5081526016602052806040812055601860205280604081205560176020526040812055565b600052601a602052604060002054806159c65750565b602490604051907f7e14c9980000000000000000000000000000000000000000000000000000000082526004820152fd5b91615a029083615b18565b15615a0e575050600090565b81615a1b82600094615974565b7f9e86dacf7b4562091d7c1a5ea12bf39ac5cef2b9a6d6d357586c636d2f0cfa3b8380a4600190565b9190615a509083615add565b9182615a595750565b600052600660205260406000205462ffffff8160c81c16615a775750565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff6001600160e01b03194260e01b16911617604060002055565b806000526006602052615ac560406000205482615b18565b615acf5750600090565b615ad890615b95565b600190565b90801580615afa575b615af1575050600090565b615ad891615cb9565b50816000526006602052615b1360406000205483615b18565b615ae6565b906002811615615b78575060005260096020526001600160a01b036040600020541660005260136020526040600020545b61ffff60155460581c169066038d7ea4c680009182810292818404149015171561127e571015615ad857600090565b6001600160581b03915060281c16615b49565b8115614d1e570690565b90601c5490600090838252602093600885526040908184205491615bbb86834401615b8b565b92801515935b87811015615cb2575b615bd381615652565b90549060031b1c85600014615ca95783835b828a52600d8c528b828b20835190615bfc826142cf565b546001600160a01b03811682526001600160581b038160a01c16809383015260f81c1515938491015282615c9e575b5050615c5257506001810180911115615bc157602487634e487b7160e01b81526011600452fd5b97505050615c779250601a829497838752601681528783882055878752528420615901565b507f9e86dacf7b4562091d7c1a5ea12bf39ac5cef2b9a6d6d357586c636d2f0cfa3b8280a4565b101590503880615c2b565b83600154615be5565b5085615bca565b91601c54926000928184526020916008835260408086205493615cde88844401615b8b565b94801515955b89811015615dd9575b615cf681615652565b90549060031b1c87600014615dd05784835b828c52600d8652818c20825190615d1e826142cf565b54906001600160a01b03821681526001600160581b038260a01c1691828983015260f81c1515938491015282615dc5575b5050615d7657506001810180911115615ce457602489634e487b7160e01b81526011600452fd5b9894965050507f9e86dacf7b4562091d7c1a5ea12bf39ac5cef2b9a6d6d357586c636d2f0cfa3b93959750615dc091601a8692838652601681528983872055898652528320615901565b5080a4565b101590503880615d4f565b84600154615d08565b5087615ced565b60405190615ded82614301565b8161012060ff601554818116845262ffffff808260081c16602086015261ffff90818360201c1660408701528260301c166060860152808260481c166080860152808260581c1660a086015264ffffffffff8260681c1660c08601528160901c1660e085015263ffffffff8160a01c1661010085015260c01c16910152565b9391929315615f4b57615e7d615de0565b92600052600d6020526001600160581b0360406000205460a01c169063ffffffff809160a01c1692670de0b6b3a76400009384810294818604149015171561127e57615f249584615f1e95151580615f42575b615f3a575b5064ffffffffff60c08701511680151580615f31575b615f27575b50615f13615f046101009361271093614d01565b61ffff60e08901511690614d01565b049401511690614d14565b90614570565b90565b9350615f13615ef0565b50848110615eeb565b935038615ed5565b50848110615ed0565b50615f24929150614d01565b615f7f90615f7a615f8493615f75601c549360ff6015541690614d14565b614570565b615b8b565b615652565b90549060031b1c9056fea26469706673582212203abcc94f187cad4b4184830c12e50c0f02b2ab1e0b8b37f2970065ca7686129864736f6c63430008110033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Txn Hash Block Value Eth2 PubKey Valid
View All Deposits
[ 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.